From ac63665f8bd0a8e8870bb3c93cbbb2823a9e7917 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Mon, 12 Nov 2018 09:31:17 +1030 Subject: [PATCH] Boot new application instance before enabling extensions. fixes #1587 (#1631) --- .../core/src/Install/Console/InstallCommand.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/framework/core/src/Install/Console/InstallCommand.php b/framework/core/src/Install/Console/InstallCommand.php index a9c8d37e4..d4cf04662 100644 --- a/framework/core/src/Install/Console/InstallCommand.php +++ b/framework/core/src/Install/Console/InstallCommand.php @@ -16,6 +16,8 @@ use Flarum\Console\AbstractCommand; use Flarum\Database\DatabaseMigrationRepository; use Flarum\Database\Migrator; use Flarum\Extension\ExtensionManager; +use Flarum\Foundation\Application as FlarumApplication; +use Flarum\Foundation\Site; use Flarum\Group\Group; use Flarum\Install\Prerequisite\PrerequisiteInterface; use Flarum\Settings\DatabaseSettingsRepository; @@ -186,9 +188,20 @@ class InstallCommand extends AbstractCommand $this->createAdminUser(); - $this->enableBundledExtensions(); - $this->publishAssets(); + + // Now that the installation of core is complete, boot up a new + // application instance before enabling extensions so that all of + // the application services are available. + Site::fromPaths([ + 'base' => $this->application->basePath(), + 'public' => $this->application->publicPath(), + 'storage' => $this->application->storagePath(), + ])->bootApp(); + + $this->application = FlarumApplication::getInstance(); + + $this->enableBundledExtensions(); } catch (Exception $e) { @unlink($this->getConfigFile());