diff --git a/config/bootstrap.php b/config/bootstrap.php index 5350d9dfd5..1911964ba8 100644 --- a/config/bootstrap.php +++ b/config/bootstrap.php @@ -197,21 +197,3 @@ //Inflector::rules('irregular', ['red' => 'redlings']); //Inflector::rules('uninflected', ['dontinflectme']); //Inflector::rules('transliteration', ['/å/' => 'aa']); - -/* - * Plugins need to be loaded manually, you can either load them one by one or all of them in a single call - * Uncomment one of the lines below, as you need. make sure you read the documentation on Plugin to use more - * advanced ways of loading plugins - * - * Plugin::loadAll(); // Loads all plugins at once - * Plugin::load('Migrations'); //Loads a single plugin named Migrations - * - */ - -/* - * Only try to load DebugKit in development mode - * Debug Kit should not be installed on a production system - */ -if (Configure::read('debug')) { - Plugin::load('DebugKit', ['bootstrap' => true]); -} diff --git a/config/bootstrap_cli.php b/config/bootstrap_cli.php index 85e119e9e1..287683a048 100644 --- a/config/bootstrap_cli.php +++ b/config/bootstrap_cli.php @@ -28,11 +28,3 @@ // Set logs to different files so they don't have permission conflicts. Configure::write('Log.debug.file', 'cli-debug'); Configure::write('Log.error.file', 'cli-error'); - -try { - Plugin::load('Bake'); -} catch (MissingPluginException $e) { - // Do not halt if the plugin is missing -} - -Plugin::load('Migrations'); diff --git a/src/Application.php b/src/Application.php index 6f7c49d617..1ed4e143bc 100644 --- a/src/Application.php +++ b/src/Application.php @@ -36,6 +36,24 @@ public function bootstrap() { // Call parent to load bootstrap from files. parent::bootstrap(); + + if (PHP_SAPI === 'cli') { + try { + $this->addPlugin('Bake'); + } catch (MissingPluginException $e) { + // Do not halt if the plugin is missing + } + + $this->addPlugin('Migrations'); + } + + /* + * Only try to load DebugKit in development mode + * Debug Kit should not be installed on a production system + */ + if (Configure::read('debug')) { + $this->addPlugin(\DebugKit\Plugin::class); + } } /**