mirror of
https://github.com/flarum/core.git
synced 2025-07-26 03:01:22 +02: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:
@@ -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\ConfigTableSeeder']);
|
||||||
$this->call('db:seed', ['--class' => 'Flarum\Core\Seeders\GroupsTableSeeder']);
|
$this->call('db:seed', ['--class' => 'Flarum\Core\Seeders\GroupsTableSeeder']);
|
||||||
$this->call('db:seed', ['--class' => 'Flarum\Core\Seeders\PermissionsTableSeeder']);
|
$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
src/Core.php
Normal file
9
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;
|
<?php namespace Flarum\Support\Extensions;
|
||||||
|
|
||||||
|
use Flarum\Core;
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
use DB;
|
use DB;
|
||||||
|
|
||||||
@@ -12,7 +13,9 @@ class ExtensionsServiceProvider extends ServiceProvider
|
|||||||
*/
|
*/
|
||||||
public function register()
|
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);
|
$extensions = json_decode(DB::table('config')->where('key', 'extensions_enabled')->pluck('value'), true);
|
||||||
$providers = [];
|
$providers = [];
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user