Browse Source

prevent surpirses with Folder not being available.

Previously loading File would load Folder also - that's not true with
the new changes, ensure that the Folder class is regsitered with
App::users when the Folder class is used.
AD7six 15 years ago
parent
commit
010feb2092

+ 4 - 3
lib/Cake/Console/Command/SchemaShell.php

@@ -20,6 +20,7 @@
  * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
  */
 App::uses('File', 'Utility');
+App::uses('Folder', 'Utility');
 App::uses('CakeSchema', 'Model');
 
 /**
@@ -150,7 +151,7 @@ class SchemaShell extends Shell {
 
 		$content = $this->Schema->read($options);
 		$content['file'] = $this->params['file'];
-		
+
 		Configure::write('Cache.disable', $cacheDisable);
 
 		if ($snapshot === true) {
@@ -271,7 +272,7 @@ class SchemaShell extends Shell {
 		if (!empty($this->params['plugin'])) {
 			$plugin = $this->params['plugin'];
 		}
-		
+
 		if (!empty($this->params['dry'])) {
 			$this->__dry = true;
 			$this->out(__d('cake_console', 'Performing a dry run.'));
@@ -463,7 +464,7 @@ class SchemaShell extends Shell {
 		$write = array(
 			'help' => __d('cake_console', 'Write the dumped SQL to a file.')
 		);
-		
+
 		$parser = parent::getOptionParser();
 		$parser->description(
 			'The Schema Shell generates a schema object from' .

+ 3 - 1
lib/Cake/Console/Command/Task/ExtractTask.php

@@ -17,6 +17,8 @@
  * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
  */
 App::uses('File', 'Utility');
+App::uses('Folder', 'Utility');
+
 /**
  * Language string extractor
  *
@@ -515,7 +517,7 @@ class ExtractTask extends Shell {
 	function __searchFiles() {
 		$pattern = false;
 		if (!empty($this->_exclude)) {
-			$pattern = '/[\/\\\\]' . implode('|', $this->_exclude) . '[\/\\\\]/'; 
+			$pattern = '/[\/\\\\]' . implode('|', $this->_exclude) . '[\/\\\\]/';
 		}
 		foreach ($this->__paths as $path) {
 			$Folder = new Folder($path);

+ 2 - 1
lib/Cake/Console/Command/Task/ProjectTask.php

@@ -19,6 +19,7 @@
  */
 
 App::uses('File', 'Utility');
+App::uses('Folder', 'Utility');
 App::uses('String', 'Utility');
 App::uses('Security', 'Utility');
 
@@ -392,4 +393,4 @@ class ProjectTask extends Shell {
 			));
 	}
 
-}
+}

+ 2 - 1
lib/Cake/tests/Case/Utility/FileTest.php

@@ -17,6 +17,7 @@
  * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
  */
 App::uses('File', 'Utility');
+App::uses('Folder', 'Utility');
 
 /**
  * FileTest class
@@ -487,4 +488,4 @@ class FileTest extends CakeTestCase {
 		}
 		return false;
 	}
-}
+}

+ 13 - 12
lib/Cake/tests/Case/View/Helper/HtmlHelperTest.php

@@ -17,12 +17,13 @@
  * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
  */
 
+App::uses('Controller', 'Controller');
 App::uses('Helper', 'View');
 App::uses('AppHelper', 'View/Helper');
-App::uses('ClassRegistry', 'Utility');
-App::uses('Controller', 'Controller');
 App::uses('HtmlHelper', 'View/Helper');
 App::uses('FomrHelper', 'View/Helper');
+App::uses('ClassRegistry', 'Utility');
+App::uses('Folder', 'Utility');
 
 if (!defined('FULL_BASE_URL')) {
 	define('FULL_BASE_URL', 'http://cakephp.org');
@@ -56,10 +57,10 @@ class TestHtmlHelper extends HtmlHelper {
 /**
  * expose a method as public
  *
- * @param string $options 
- * @param string $exclude 
- * @param string $insertBefore 
- * @param string $insertAfter 
+ * @param string $options
+ * @param string $exclude
+ * @param string $insertBefore
+ * @param string $insertAfter
  * @return void
  */
 	function parseAttributes($options, $exclude = null, $insertBefore = ' ', $insertAfter = null) {
@@ -639,7 +640,7 @@ class HtmlHelperTest extends CakeTestCase {
 			'script' => array('type' => 'text/javascript', 'src' => 'js/jquery-1.3.2.js', 'defer' => 'defer', 'encoding' => 'utf-8')
 		);
 		$this->assertTags($result, $expected);
-		
+
 		$this->View->expects($this->any())->method('addScript')
 			->with($this->matchesRegularExpression('/script_in_head.js/'));
 		$result = $this->Html->script('script_in_head', array('inline' => false));
@@ -711,7 +712,7 @@ class HtmlHelperTest extends CakeTestCase {
 		);
 		$this->assertTags($result, $expected);
 
-		
+
 		$this->View->expects($this->any())->method('addScript')
 			->with($this->matchesRegularExpression('/window\.foo\s\=\s2;/'));
 
@@ -1342,12 +1343,12 @@ class HtmlHelperTest extends CakeTestCase {
 		$result = $this->Html->para('class-name', '<text>', array('escape' => true));
 		$this->assertTags($result, array('p' => array('class' => 'class-name'), '&lt;text&gt;', '/p'));
 	}
-	
+
 /**
  * testCrumbList method
- * 
+ *
  * @access public
- * 
+ *
  * @return void
  */
 	function testCrumbList() {
@@ -1435,7 +1436,7 @@ class HtmlHelperTest extends CakeTestCase {
 		$helper = new TestHtmlHelper($this->View);
 		$compact = array('compact', 'checked', 'declare', 'readonly', 'disabled',
 			'selected', 'defer', 'ismap', 'nohref', 'noshade', 'nowrap', 'multiple', 'noresize');
-		
+
 		foreach ($compact as $attribute) {
 			foreach (array('true', true, 1, '1', $attribute) as $value) {
 				$attrs = array($attribute => $value);