Copy the config.php file upon installation.

This allows us to know whether Flarum is already installed, so that
we can disable certain service providers when it isn't.

This should fix #67.
This commit is contained in:
Franz Liedke 2015-05-08 20:37:07 +02:00
parent 00bf235809
commit 97bab21c1d
3 changed files with 16 additions and 1 deletions

View File

@ -47,6 +47,9 @@ class InstallCommand extends Command {
$this->call('db:seed', ['--class' => 'Flarum\Core\Seeders\ConfigTableSeeder']);
$this->call('db:seed', ['--class' => 'Flarum\Core\Seeders\GroupsTableSeeder']);
$this->call('db:seed', ['--class' => 'Flarum\Core\Seeders\PermissionsTableSeeder']);
// Create config file so that we know Flarum is installed
copy(base_path('../config.example.php'), base_path('../config.php'));
}
/**

View File

@ -0,0 +1,9 @@
<?php namespace Flarum;
class Core
{
public static function isInstalled()
{
return file_exists(base_path('../config.php'));
}
}

View File

@ -1,5 +1,6 @@
<?php namespace Flarum\Support\Extensions;
use Flarum\Core;
use Illuminate\Support\ServiceProvider;
use DB;
@ -12,7 +13,9 @@ class ExtensionsServiceProvider extends ServiceProvider
*/
public function register()
{
$app = $this->app;
// Extensions will not be registered if Flarum is not installed yet
if (!Core::isInstalled()) return;
$extensions = json_decode(DB::table('config')->where('key', 'extensions_enabled')->pluck('value'), true);
$providers = [];