mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Adding _pluginPath to Shell.
provides one method to find plugins in shells.
This commit is contained in:
parent
928ec36acf
commit
d312cd3215
1 changed files with 16 additions and 0 deletions
|
@ -611,5 +611,21 @@ class Shell extends Object {
|
|||
function _pluralHumanName($name) {
|
||||
return Inflector::humanize(Inflector::underscore(Inflector::pluralize($name)));
|
||||
}
|
||||
/**
|
||||
* Find the correct path for a plugin. Scans $pluginPaths for the plugin you want.
|
||||
*
|
||||
* @param string $pluginName Name of the plugin you want ie. DebugKit
|
||||
* @return string $path path to the correct plugin.
|
||||
**/
|
||||
function _pluginPath($pluginName) {
|
||||
$pluginPaths = Configure::read('pluginPaths');
|
||||
$pluginDirName = Inflector::underscore($pluginName);
|
||||
foreach ($pluginPaths as $path) {
|
||||
if (is_dir($path . $pluginDirName)) {
|
||||
return $path . $pluginDirName . DS ;
|
||||
}
|
||||
}
|
||||
return $pluginPaths[0] . $pluginDirName . DS;
|
||||
}
|
||||
}
|
||||
?>
|
Loading…
Reference in a new issue