diff --git a/modules/system/ServiceProvider.php b/modules/system/ServiceProvider.php index aabc01181..94cf56830 100644 --- a/modules/system/ServiceProvider.php +++ b/modules/system/ServiceProvider.php @@ -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 */ diff --git a/modules/system/classes/PluginManager.php b/modules/system/classes/PluginManager.php index 7c8efe11f..2da124526 100644 --- a/modules/system/classes/PluginManager.php +++ b/modules/system/classes/PluginManager.php @@ -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) {