Boot app before attempting upgrade

pull/11/head
Toby Zerner 2015-09-14 18:58:14 +09:30
parent 38b832bbf7
commit 7d257565cc
1 changed files with 20 additions and 20 deletions

View File

@ -111,10 +111,25 @@ if (Core::isInstalled()) {
$app->register(new \Flarum\Core\CoreServiceProvider($app));
$config->set('mail.driver', Core::config('mail_driver'));
$config->set('mail.host', Core::config('mail_host'));
$config->set('mail.port', Core::config('mail_port'));
$config->set('mail.from.address', Core::config('mail_from'));
$config->set('mail.from.name', Core::config('forum_title'));
$config->set('mail.encryption', Core::config('mail_encryption'));
$config->set('mail.username', Core::config('mail_username'));
$config->set('mail.password', Core::config('mail_password'));
// Register extensions and tell them to listen for events
$app->register(new \Flarum\Support\ExtensionsServiceProvider($app));
}
$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 ($settings->get('version') !== $app::VERSION) {
if (Core::isInstalled() && $settings->get('version') !== $app::VERSION) {
$input = new \Symfony\Component\Console\Input\StringInput('');
$output = new \Symfony\Component\Console\Output\BufferedOutput;
@ -131,19 +146,4 @@ if (Core::isInstalled()) {
$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'));
$config->set('mail.from.address', Core::config('mail_from'));
$config->set('mail.from.name', Core::config('forum_title'));
$config->set('mail.encryption', Core::config('mail_encryption'));
$config->set('mail.username', Core::config('mail_username'));
$config->set('mail.password', Core::config('mail_password'));
// Register extensions and tell them to listen for events
$app->register(new \Flarum\Support\ExtensionsServiceProvider($app));
}
$app->boot();
return $app;