Skip to content
This repository
Browse code

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

  • Loading branch information...
commit 2f81c29defe52f81ebef88d1306b53dd57534ddf 1 parent de8f251
Mark Story authored October 14, 2009
15  cake/console/cake.php
@@ -222,18 +222,15 @@ function _initEnvironment() {
222 222
  */
223 223
 	function __buildPaths() {
224 224
 		$paths = array();
225  
-		$pluginPaths = App::path('plugins');
226 225
 		if (!class_exists('Folder')) {
227 226
 			require LIBS . 'folder.php';
228 227
 		}
229  
-		foreach ($pluginPaths as $pluginPath) {
230  
-			$Folder = new Folder($pluginPath);
231  
-			list($plugins,) = $Folder->read(false, true);
232  
-			foreach ((array)$plugins as $plugin) {
233  
-				$path = $pluginPath . Inflector::underscore($plugin) . DS . 'vendors' . DS . 'shells' . DS;
234  
-				if (file_exists($path)) {
235  
-					$paths[] = $path;
236  
-				}
  228
+		$plugins = App::objects('plugin', null, false);
  229
+		foreach ((array)$plugins as $plugin) {
  230
+			$pluginPath = App::pluginPath($plugin);
  231
+			$path = $pluginPath . 'vendors' . DS . 'shells' . DS;
  232
+			if (file_exists($path)) {
  233
+				$paths[] = $path;
237 234
 			}
238 235
 		}
239 236
 
10  cake/console/libs/shell.php
@@ -649,15 +649,7 @@ function _pluralHumanName($name) {
649 649
  * @return string $path path to the correct plugin.
650 650
  **/
651 651
 	function _pluginPath($pluginName) {
652  
-		$pluginPaths = App::path('plugins');
653  
-		$pluginDirName = Inflector::underscore($pluginName);
654  
-
655  
-		foreach ($pluginPaths as $path) {
656  
-			if (is_dir($path . $pluginDirName)) {
657  
-				return $path . $pluginDirName . DS ;
658  
-			}
659  
-		}
660  
-		return $pluginPaths[0] . $pluginDirName . DS;
  652
+		return App::pluginPath($pluginName);
661 653
 	}
662 654
 }
663 655
 ?>
6  cake/dispatcher.php
@@ -648,11 +648,7 @@ function cached($url) {
648 648
 				if ($pos > 0) {
649 649
 					$plugin = substr($url, 0, $pos - 1);
650 650
 					$url = preg_replace('/^' . preg_quote($plugin, '/') . '\//i', '', $url);
651  
-					$pluginPaths = App::path('plugins');
652  
-					$count = count($pluginPaths);
653  
-					for ($i = 0; $i < $count; $i++) {
654  
-						$paths[] = $pluginPaths[$i] . $plugin . DS . 'vendors' . DS;
655  
-					}
  651
+					$paths[] = App::pluginPath($plugin) . 'vendors' . DS;
656 652
 				}
657 653
 				$paths = array_merge($paths, App::path('vendors'));
658 654
 
9  cake/tests/lib/test_manager.php
@@ -357,12 +357,9 @@ function _getTestsPath($type = 'cases') {
357 357
 			}
358 358
 		} else if (!empty($this->pluginTest)) {
359 359
 			$_pluginBasePath = APP . 'plugins' . DS . $this->pluginTest . DS . 'tests';
360  
-			$pluginPaths = App::path('plugins');
361  
-			foreach ($pluginPaths as $path) {
362  
-				if (file_exists($path . $this->pluginTest . DS . 'tests')) {
363  
-					$_pluginBasePath = $path . $this->pluginTest . DS . 'tests';
364  
-					break;
365  
-				}
  360
+			$pluginPath = App::pluginPath($this->pluginTest);
  361
+			if (file_exists($pluginPath . DS . 'tests')) {
  362
+				$_pluginBasePath = $pluginPath . DS . 'tests';
366 363
 			}
367 364
 			$result = $_pluginBasePath . DS . $type;
368 365
 		} else {

0 notes on commit 2f81c29

Please sign in to comment.
Something went wrong with that request. Please try again.