From 7d257565ccd8ff9eaf73f71c0ff36e20c1f3f542 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Mon, 14 Sep 2015 18:58:14 +0930 Subject: [PATCH] Boot app before attempting upgrade --- flarum/bootstrap.php | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/flarum/bootstrap.php b/flarum/bootstrap.php index a89da29..11d4ed1 100644 --- a/flarum/bootstrap.php +++ b/flarum/bootstrap.php @@ -111,26 +111,6 @@ if (Core::isInstalled()) { $app->register(new \Flarum\Core\CoreServiceProvider($app)); - // If the version stored in the database doesn't match the version of the - // code, then run the upgrade script (migrations). This is temporary - a - // proper, more secure upgrade method is planned. - if ($settings->get('version') !== $app::VERSION) { - $input = new \Symfony\Component\Console\Input\StringInput(''); - $output = new \Symfony\Component\Console\Output\BufferedOutput; - - app('Flarum\Console\UpgradeCommand')->run($input, $output); - - $settings->set('version', $app::VERSION); - - app('flarum.formatter')->flush(); - - $forum = app('Flarum\Forum\Actions\ClientAction'); - $forum->flushAssets(); - - $admin = app('Flarum\Admin\Actions\ClientAction'); - $admin->flushAssets(); - } - $config->set('mail.driver', Core::config('mail_driver')); $config->set('mail.host', Core::config('mail_host')); $config->set('mail.port', Core::config('mail_port')); @@ -146,4 +126,24 @@ if (Core::isInstalled()) { $app->boot(); +// If the version stored in the database doesn't match the version of the +// code, then run the upgrade script (migrations). This is temporary - a +// proper, more secure upgrade method is planned. +if (Core::isInstalled() && $settings->get('version') !== $app::VERSION) { + $input = new \Symfony\Component\Console\Input\StringInput(''); + $output = new \Symfony\Component\Console\Output\BufferedOutput; + + app('Flarum\Console\UpgradeCommand')->run($input, $output); + + $settings->set('version', $app::VERSION); + + app('flarum.formatter')->flush(); + + $forum = app('Flarum\Forum\Actions\ClientAction'); + $forum->flushAssets(); + + $admin = app('Flarum\Admin\Actions\ClientAction'); + $admin->flushAssets(); +} + return $app;