mirror of
https://github.com/flarum/core.git
synced 2025-10-23 04:36:08 +02:00
Use Laravel filesystem interface for assets and avatars (#2729)
* WIP: Use Laravel filesystem interface where possible * Drop vendorFilesystem * Support getting URL of cloud-based logo and favicon * FilesystemAdapter should always be cloud * Get base avatar URL from filesystem adapter * Restore deleted getAsset method Co-authored-by: Alexander Skvortsov <askvortsov1@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
a2d77d7b81
commit
f67149bb06
@@ -11,8 +11,9 @@ namespace Flarum\Api\Controller;
|
||||
|
||||
use Flarum\Http\RequestUtil;
|
||||
use Flarum\Settings\SettingsRepositoryInterface;
|
||||
use Illuminate\Contracts\Filesystem\Factory;
|
||||
use Illuminate\Contracts\Filesystem\Filesystem;
|
||||
use Laminas\Diactoros\Response\EmptyResponse;
|
||||
use League\Flysystem\FilesystemInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
|
||||
class DeleteLogoController extends AbstractDeleteController
|
||||
@@ -23,18 +24,18 @@ class DeleteLogoController extends AbstractDeleteController
|
||||
protected $settings;
|
||||
|
||||
/**
|
||||
* @var FilesystemInterface
|
||||
* @var Filesystem
|
||||
*/
|
||||
protected $uploadDir;
|
||||
|
||||
/**
|
||||
* @param SettingsRepositoryInterface $settings
|
||||
* @param FilesystemInterface $uploadDir
|
||||
* @param Factory $filesystemFactory
|
||||
*/
|
||||
public function __construct(SettingsRepositoryInterface $settings, FilesystemInterface $uploadDir)
|
||||
public function __construct(SettingsRepositoryInterface $settings, Factory $filesystemFactory)
|
||||
{
|
||||
$this->settings = $settings;
|
||||
$this->uploadDir = $uploadDir;
|
||||
$this->uploadDir = $filesystemFactory->disk('flarum-assets');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -48,7 +49,7 @@ class DeleteLogoController extends AbstractDeleteController
|
||||
|
||||
$this->settings->set('logo_path', null);
|
||||
|
||||
if ($this->uploadDir->has($path)) {
|
||||
if ($this->uploadDir->exists($path)) {
|
||||
$this->uploadDir->delete($path);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user