mirror of
https://github.com/flarum/framework.git
synced 2024-12-05 00:43:39 +08:00
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:
parent
00bf235809
commit
97bab21c1d
|
@ -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'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
9
framework/core/src/Core.php
Normal file
9
framework/core/src/Core.php
Normal file
|
@ -0,0 +1,9 @@
|
|||
<?php namespace Flarum;
|
||||
|
||||
class Core
|
||||
{
|
||||
public static function isInstalled()
|
||||
{
|
||||
return file_exists(base_path('../config.php'));
|
||||
}
|
||||
}
|
|
@ -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 = [];
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user