Some things should not be run when Flarum is not installed yet

This commit is contained in:
Franz Liedke 2015-07-02 23:14:25 +02:00
parent 12dd550a14
commit 126039850a
2 changed files with 9 additions and 6 deletions

View File

@ -9,7 +9,7 @@ class Core
public static function inDebugMode() public static function inDebugMode()
{ {
return app('flarum.config')['debug']; return static::isInstalled() && app('flarum.config')['debug'];
} }
public static function config($key, $default = null) public static function config($key, $default = null)

View File

@ -1,5 +1,6 @@
<?php namespace Flarum\Core; <?php namespace Flarum\Core;
use Flarum\Core;
use Illuminate\Bus\Dispatcher as Bus; use Illuminate\Bus\Dispatcher as Bus;
use Illuminate\Contracts\Container\Container; use Illuminate\Contracts\Container\Container;
use Flarum\Support\ServiceProvider; use Flarum\Support\ServiceProvider;
@ -23,11 +24,13 @@ class CoreServiceProvider extends ServiceProvider
{ {
$this->loadViewsFrom(__DIR__.'/../../views', 'flarum'); $this->loadViewsFrom(__DIR__.'/../../views', 'flarum');
$this->addEventHandlers(); if (Core::isInstalled()) {
$this->bootModels(); $this->addEventHandlers();
$this->addPostTypes(); $this->bootModels();
$this->grantPermissions(); $this->addPostTypes();
$this->mapCommandHandlers(); $this->grantPermissions();
$this->mapCommandHandlers();
}
} }
public function mapCommandHandlers() public function mapCommandHandlers()