Check for CLI or system/updates route and disable any plugin initialization
This commit is contained in:
parent
7e62ef5925
commit
d78dadafd0
|
|
@ -60,6 +60,15 @@ class ServiceProvider extends ModuleServiceProvider
|
|||
App::singleton('backend.menu', function() { return \Backend\Classes\NavigationManager::instance(); });
|
||||
App::singleton('backend.auth', function() { return \Backend\Classes\AuthManager::instance(); });
|
||||
|
||||
/*
|
||||
* Check for CLI or system/updates route and disable any plugin initialization
|
||||
* @todo This should be moved to middleware
|
||||
*/
|
||||
$requestPath = \October\Rain\Router\Helper::normalizeUrl(\Request::path());
|
||||
$systemPath = \October\Rain\Router\Helper::normalizeUrl(Config::get('cms.backendUri') . '/system/updates');
|
||||
if (App::runningInConsole() || stripos($requestPath, $systemPath) === 0)
|
||||
PluginManager::$noInit = true;
|
||||
|
||||
/*
|
||||
* Register all plugins
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -56,6 +56,11 @@ class PluginManager
|
|||
*/
|
||||
protected $disabledPlugins = [];
|
||||
|
||||
/**
|
||||
* @var boolean Prevent all plugins from registering or booting
|
||||
*/
|
||||
public static $noInit = false;
|
||||
|
||||
/**
|
||||
* Initializes the plugin manager
|
||||
*/
|
||||
|
|
@ -111,7 +116,7 @@ class PluginManager
|
|||
*/
|
||||
public function registerAll()
|
||||
{
|
||||
if ($this->registered)
|
||||
if ($this->registered || self::$noInit)
|
||||
return;
|
||||
|
||||
foreach ($this->plugins as $pluginId => $plugin) {
|
||||
|
|
@ -166,7 +171,7 @@ class PluginManager
|
|||
*/
|
||||
public function bootAll()
|
||||
{
|
||||
if ($this->booted)
|
||||
if ($this->booted || self::$noInit)
|
||||
return;
|
||||
|
||||
foreach ($this->plugins as $plugin) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue