mirror of
https://github.com/flarum/core.git
synced 2025-08-01 22:20:21 +02:00
Don't resolve routes early.
In normal Flarum, extensions are only enabled during requests. Here, however, we enable some during boot. This resolves the FilesystemManager early, which resolves the Url Generator early. To fix this, we directly provide a filesystem disk for assets instead of getting it from the filesystem manager.
This commit is contained in:
@@ -11,7 +11,11 @@ namespace Flarum\Testing\integration\Extension;
|
||||
|
||||
use Flarum\Extension\Extension;
|
||||
use Flarum\Extension\ExtensionManager;
|
||||
use Illuminate\Contracts\Filesystem\Cloud;
|
||||
use Illuminate\Filesystem\FilesystemAdapter;
|
||||
use Illuminate\Support\Arr;
|
||||
use League\Flysystem\Adapter\Local;
|
||||
use League\Flysystem\Filesystem;
|
||||
|
||||
class ExtensionManagerIncludeCurrent extends ExtensionManager
|
||||
{
|
||||
@@ -39,4 +43,14 @@ class ExtensionManagerIncludeCurrent extends ExtensionManager
|
||||
|
||||
return $this->extensions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an instance of the assets filesystem.
|
||||
* This is resolved dynamically because Flarum's filesystem configuration
|
||||
* might not be booted yet when the ExtensionManager singleton initializes.
|
||||
*/
|
||||
protected function getAssetsFilesystem(): Cloud
|
||||
{
|
||||
return new FilesystemAdapter(new Filesystem(new Local($this->paths->public.'/assets'), ['url' => resolve('flarum.config')->url().'/assets']));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user