mirror of
https://github.com/flarum/core.git
synced 2025-07-26 19:20:21 +02:00
Add ExtensionsServiceProvider to load enabled extensions
This commit is contained in:
@@ -0,0 +1,33 @@
|
|||||||
|
<?php namespace Flarum\Support\Extensions;
|
||||||
|
|
||||||
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
use DB;
|
||||||
|
|
||||||
|
class ExtensionsServiceProvider extends ServiceProvider
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Bootstrap the application events.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function boot()
|
||||||
|
{
|
||||||
|
//
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register the service provider.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function register()
|
||||||
|
{
|
||||||
|
$extensions = json_decode(DB::table('config')->where('key', 'extensions_enabled')->pluck('value'), true);
|
||||||
|
|
||||||
|
foreach ($extensions as $extension) {
|
||||||
|
if (file_exists($file = base_path().'/extensions/'.$extension.'/bootstrap.php')) {
|
||||||
|
require $file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user