Permalink
Browse files

Updating $pluginPath loops to use App::pluginPath().

  • Loading branch information...
markstory committed Oct 14, 2009
1 parent ecc7d9b commit 7b1d21692f0fa13a2b8be1d2c20562f94d29f55a
Showing with 11 additions and 29 deletions.
  1. +6 −9 cake/console/cake.php
  2. +1 −9 cake/console/libs/shell.php
  3. +1 −5 cake/dispatcher.php
  4. +3 −6 cake/tests/lib/test_manager.php
View
@@ -222,18 +222,15 @@ function _initEnvironment() {
*/
function __buildPaths() {
$paths = array();
- $pluginPaths = App::path('plugins');
if (!class_exists('Folder')) {
require LIBS . 'folder.php';
}
- foreach ($pluginPaths as $pluginPath) {
- $Folder = new Folder($pluginPath);
- list($plugins,) = $Folder->read(false, true);
- foreach ((array)$plugins as $plugin) {
- $path = $pluginPath . Inflector::underscore($plugin) . DS . 'vendors' . DS . 'shells' . DS;
- if (file_exists($path)) {
- $paths[] = $path;
- }
+ $plugins = App::objects('plugin', null, false);
+ foreach ((array)$plugins as $plugin) {
+ $pluginPath = App::pluginPath($plugin);
+ $path = $pluginPath . 'vendors' . DS . 'shells' . DS;
+ if (file_exists($path)) {
+ $paths[] = $path;
}
}
@@ -649,15 +649,7 @@ function _pluralHumanName($name) {
* @return string $path path to the correct plugin.
**/
function _pluginPath($pluginName) {
- $pluginPaths = App::path('plugins');
- $pluginDirName = Inflector::underscore($pluginName);
-
- foreach ($pluginPaths as $path) {
- if (is_dir($path . $pluginDirName)) {
- return $path . $pluginDirName . DS ;
- }
- }
- return $pluginPaths[0] . $pluginDirName . DS;
+ return App::pluginPath($pluginName);
}
}
?>
View
@@ -648,11 +648,7 @@ function cached($url) {
if ($pos > 0) {
$plugin = substr($url, 0, $pos - 1);
$url = preg_replace('/^' . preg_quote($plugin, '/') . '\//i', '', $url);
- $pluginPaths = App::path('plugins');
- $count = count($pluginPaths);
- for ($i = 0; $i < $count; $i++) {
- $paths[] = $pluginPaths[$i] . $plugin . DS . 'vendors' . DS;
- }
+ $paths[] = App::pluginPath($plugin) . 'vendors' . DS;
}
$paths = array_merge($paths, App::path('vendors'));
@@ -357,12 +357,9 @@ function _getTestsPath($type = 'cases') {
}
} else if (!empty($this->pluginTest)) {
$_pluginBasePath = APP . 'plugins' . DS . $this->pluginTest . DS . 'tests';
- $pluginPaths = App::path('plugins');
- foreach ($pluginPaths as $path) {
- if (file_exists($path . $this->pluginTest . DS . 'tests')) {
- $_pluginBasePath = $path . $this->pluginTest . DS . 'tests';
- break;
- }
+ $pluginPath = App::pluginPath($this->pluginTest);
+ if (file_exists($pluginPath . DS . 'tests')) {
+ $_pluginBasePath = $pluginPath . DS . 'tests';
}
$result = $_pluginBasePath . DS . $type;
} else {

0 comments on commit 7b1d216

Please sign in to comment.