mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
Updating $pluginPath loops to use App::pluginPath().
This commit is contained in:
parent
de8f251758
commit
2f81c29def
4 changed files with 11 additions and 29 deletions
|
@ -222,18 +222,15 @@ class ShellDispatcher {
|
||||||
*/
|
*/
|
||||||
function __buildPaths() {
|
function __buildPaths() {
|
||||||
$paths = array();
|
$paths = array();
|
||||||
$pluginPaths = App::path('plugins');
|
|
||||||
if (!class_exists('Folder')) {
|
if (!class_exists('Folder')) {
|
||||||
require LIBS . 'folder.php';
|
require LIBS . 'folder.php';
|
||||||
}
|
}
|
||||||
foreach ($pluginPaths as $pluginPath) {
|
$plugins = App::objects('plugin', null, false);
|
||||||
$Folder = new Folder($pluginPath);
|
foreach ((array)$plugins as $plugin) {
|
||||||
list($plugins,) = $Folder->read(false, true);
|
$pluginPath = App::pluginPath($plugin);
|
||||||
foreach ((array)$plugins as $plugin) {
|
$path = $pluginPath . 'vendors' . DS . 'shells' . DS;
|
||||||
$path = $pluginPath . Inflector::underscore($plugin) . DS . 'vendors' . DS . 'shells' . DS;
|
if (file_exists($path)) {
|
||||||
if (file_exists($path)) {
|
$paths[] = $path;
|
||||||
$paths[] = $path;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -649,15 +649,7 @@ class Shell extends Object {
|
||||||
* @return string $path path to the correct plugin.
|
* @return string $path path to the correct plugin.
|
||||||
**/
|
**/
|
||||||
function _pluginPath($pluginName) {
|
function _pluginPath($pluginName) {
|
||||||
$pluginPaths = App::path('plugins');
|
return App::pluginPath($pluginName);
|
||||||
$pluginDirName = Inflector::underscore($pluginName);
|
|
||||||
|
|
||||||
foreach ($pluginPaths as $path) {
|
|
||||||
if (is_dir($path . $pluginDirName)) {
|
|
||||||
return $path . $pluginDirName . DS ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $pluginPaths[0] . $pluginDirName . DS;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
|
@ -648,11 +648,7 @@ class Dispatcher extends Object {
|
||||||
if ($pos > 0) {
|
if ($pos > 0) {
|
||||||
$plugin = substr($url, 0, $pos - 1);
|
$plugin = substr($url, 0, $pos - 1);
|
||||||
$url = preg_replace('/^' . preg_quote($plugin, '/') . '\//i', '', $url);
|
$url = preg_replace('/^' . preg_quote($plugin, '/') . '\//i', '', $url);
|
||||||
$pluginPaths = App::path('plugins');
|
$paths[] = App::pluginPath($plugin) . 'vendors' . DS;
|
||||||
$count = count($pluginPaths);
|
|
||||||
for ($i = 0; $i < $count; $i++) {
|
|
||||||
$paths[] = $pluginPaths[$i] . $plugin . DS . 'vendors' . DS;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
$paths = array_merge($paths, App::path('vendors'));
|
$paths = array_merge($paths, App::path('vendors'));
|
||||||
|
|
||||||
|
|
|
@ -357,12 +357,9 @@ class TestManager {
|
||||||
}
|
}
|
||||||
} else if (!empty($this->pluginTest)) {
|
} else if (!empty($this->pluginTest)) {
|
||||||
$_pluginBasePath = APP . 'plugins' . DS . $this->pluginTest . DS . 'tests';
|
$_pluginBasePath = APP . 'plugins' . DS . $this->pluginTest . DS . 'tests';
|
||||||
$pluginPaths = App::path('plugins');
|
$pluginPath = App::pluginPath($this->pluginTest);
|
||||||
foreach ($pluginPaths as $path) {
|
if (file_exists($pluginPath . DS . 'tests')) {
|
||||||
if (file_exists($path . $this->pluginTest . DS . 'tests')) {
|
$_pluginBasePath = $pluginPath . DS . 'tests';
|
||||||
$_pluginBasePath = $path . $this->pluginTest . DS . 'tests';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
$result = $_pluginBasePath . DS . $type;
|
$result = $_pluginBasePath . DS . $type;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Reference in a new issue