Skip to content

Commit

Permalink
Merge pull request #617 from cakephp/load-plugin
Browse files Browse the repository at this point in the history
move loading plugins into Application
  • Loading branch information
markstory committed Jul 7, 2018
2 parents 00a0c8e + 061d4c5 commit 23ee39e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 26 deletions.
18 changes: 0 additions & 18 deletions config/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}
8 changes: 0 additions & 8 deletions config/bootstrap_cli.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
18 changes: 18 additions & 0 deletions src/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

/**
Expand Down

0 comments on commit 23ee39e

Please sign in to comment.