mirror of https://github.com/flarum/flarum
Upgrade the database on page load if necessary
parent
79a7f8d047
commit
0ff233e8a1
|
@ -107,6 +107,20 @@ foreach ($serviceProviders as $provider) {
|
|||
}
|
||||
|
||||
if (Core::isInstalled()) {
|
||||
$settings = $app->make('Flarum\Core\Settings\SettingsRepository');
|
||||
|
||||
// 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->register(new \Flarum\Core\CoreServiceProvider($app));
|
||||
|
||||
$config->set('mail.driver', Core::config('mail_driver'));
|
||||
|
|
Loading…
Reference in New Issue