Browse Source

remove CONFIGS constant

AD7six 15 years ago
parent
commit
0cb70ae3bb

+ 6 - 3
lib/Cake/Configure/PhpReader.php

@@ -34,9 +34,12 @@ class PhpReader implements ConfigReaderInterface {
 /**
  * Constructor for PHP Config file reading.
  *
- * @param string $path The path to read config files from.  Defaults to CONFIGS
+ * @param string $path The path to read config files from.  Defaults to APP . 'Config' . DS
  */
-	public function __construct($path = CONFIGS) {
+	public function __construct($path = null) {
+		if (!$path) {
+			$path = APP . 'Config' . DS;
+		}
 		$this->_path = $path;
 	}
 
@@ -81,4 +84,4 @@ class PhpReader implements ConfigReaderInterface {
 		}
 		return $config;
 	}
-}
+}

+ 5 - 5
lib/Cake/Console/Command/AclShell.php

@@ -20,7 +20,7 @@ App::uses('AclComponent', 'Controller/Component');
 App::uses('DbAcl', 'Model');
 
 /**
- * Shell for ACL management.  This console is known to have issues with zend.ze1_compatibility_mode 
+ * Shell for ACL management.  This console is known to have issues with zend.ze1_compatibility_mode
  * being enabled.  Be sure to turn it off when using this shell.
  *
  * @package       cake.console.libs
@@ -86,7 +86,7 @@ class AclShell extends Shell {
 				$this->args = null;
 				return $this->DbConfig->execute();
 			}
-			require_once (CONFIGS.'database.php');
+			require_once (APP . 'Config' . DS . 'database.php');
 
 			if (!in_array($this->command, array('initdb'))) {
 				$collection = new ComponentCollection();
@@ -348,13 +348,13 @@ class AclShell extends Shell {
  */
 	public function getOptionParser() {
 		$parser = parent::getOptionParser();
-		
+
 		$type = array(
-			'choices' => array('aro', 'aco'), 
+			'choices' => array('aro', 'aco'),
 			'required' => true,
 			'help' => __d('cake_console', 'Type of node to create.')
 		);
-		
+
 		$parser->description(__d('cake_console', 'A console tool for managing the DbAcl'))
 			->addSubcommand('create', array(
 				'help' => __d('cake_console', 'Create a new ACL node'),

+ 1 - 1
lib/Cake/Console/Command/ConsoleShell.php

@@ -339,7 +339,7 @@ class ConsoleShell extends Shell {
 		Router::reload();
 		extract(Router::getNamedExpressions());
 
-		if (!@include(CONFIGS . 'routes.php')) {
+		if (!@include(APP . 'Config' . DS . 'routes.php')) {
 			return false;
 		}
 		Router::parse('/');

+ 1 - 1
lib/Cake/Console/Command/SchemaShell.php

@@ -440,7 +440,7 @@ class SchemaShell extends Shell {
 		);
 		$path = array(
 			'help' => __d('cake_console', 'Path to read and write schema.php'),
-			'default' => CONFIGS . 'Schema'
+			'default' => APP . 'Config' . 'Schema'
 		);
 		$file = array(
 			'help' => __d('cake_console', 'File name to read and write.'),

+ 3 - 3
lib/Cake/Console/Command/Task/ProjectTask.php

@@ -82,14 +82,14 @@ class ProjectTask extends Shell {
 			if ($this->securitySalt($path) === true) {
 				$this->out(__d('cake_console', ' * Random hash key created for \'Security.salt\''));
 			} else {
-				$this->err(__d('cake_console', 'Unable to generate random hash for \'Security.salt\', you should change it in %s', CONFIGS . 'core.php'));
+				$this->err(__d('cake_console', 'Unable to generate random hash for \'Security.salt\', you should change it in %s', APP . 'Config' . DS . 'core.php'));
 				$success = false;
 			}
 
 			if ($this->securityCipherSeed($path) === true) {
 				$this->out(__d('cake_console', ' * Random seed created for \'Security.cipherSeed\''));
 			} else {
-				$this->err(__d('cake_console', 'Unable to generate random seed for \'Security.cipherSeed\', you should change it in %s', CONFIGS . 'core.php'));
+				$this->err(__d('cake_console', 'Unable to generate random seed for \'Security.cipherSeed\', you should change it in %s', APP . 'Config' . DS . 'core.php'));
 				$success = false;
 			}
 
@@ -313,7 +313,7 @@ class ProjectTask extends Shell {
  * @return boolean Success
  */
 	public function cakeAdmin($name) {
-		$path = (empty($this->configPath)) ? CONFIGS : $this->configPath;
+		$path = (empty($this->configPath)) ? APP . 'Config' . DS : $this->configPath;
 		$File = new File($path . 'core.php');
 		$contents = $File->read();
 		if (preg_match('%(\s*[/]*Configure::write\(\'Routing.prefixes\',[\s\'a-z,\)\(]*\);)%', $contents, $match)) {

+ 2 - 2
lib/Cake/Console/templates/default/views/home.ctp

@@ -37,7 +37,7 @@ endif;
 <p>
 <?php
 	\$filePresent = null;
-	if (file_exists(CONFIGS . 'database.php')):
+	if (file_exists(APP . 'Config' . DS . 'database.php')):
 		echo '<span class=\"notice success\">';
 			echo __('Your database configuration file is present.');
 			\$filePresent = true;
@@ -93,4 +93,4 @@ $output .= "\t\tYou can also add some CSS styles for your pages at: %s',\n";
 $output .= "\t\tAPP . 'View' . DS . 'Pages' . DS . 'home.ctp.<br />',  APP . 'View' . DS . 'Layouts' . DS . 'default.ctp.<br />', APP . 'webroot' . DS . 'css');\n";
 $output .= "?>\n";
 $output .= "</p>\n";
-?>
+?>

+ 12 - 12
lib/Cake/Controller/Component/AclComponent.php

@@ -238,8 +238,8 @@ interface AclInterface {
 }
 
 /**
- * DbAcl implements an ACL control system in the database.  ARO's and ACO's are 
- * structured into trees and a linking table is used to define permissions.  You 
+ * DbAcl implements an ACL control system in the database.  ARO's and ACO's are
+ * structured into trees and a linking table is used to define permissions.  You
  * can install the schema for DbAcl with the Schema Shell.
  *
  * `$aco` and `$aro` parameters can be slash delimited paths to tree nodes.
@@ -515,7 +515,7 @@ class DbAcl extends Object implements AclInterface {
 }
 
 /**
- * IniAcl implements an access control system using an INI file.  An example 
+ * IniAcl implements an access control system using an INI file.  An example
  * of the ini file used can be found in /config/acl.ini.php.
  *
  * @package       cake.libs.model.iniacl
@@ -542,11 +542,11 @@ class IniAcl extends Object implements AclInterface {
 /**
  * Initialize method
  *
- * @param AclBase $component 
+ * @param AclBase $component
  * @return void
  */
 	public function initialize($component) {
-		
+
 	}
 
 /**
@@ -558,7 +558,7 @@ class IniAcl extends Object implements AclInterface {
  * @return boolean Success
  */
 	public function allow($aro, $aco, $action = "*") {
-		
+
 	}
 
 /**
@@ -570,7 +570,7 @@ class IniAcl extends Object implements AclInterface {
  * @return boolean Success
  */
 	public function deny($aro, $aco, $action = "*") {
-		
+
 	}
 
 /**
@@ -582,12 +582,12 @@ class IniAcl extends Object implements AclInterface {
  * @return boolean Success
  */
 	public function inherit($aro, $aco, $action = "*") {
-		
+
 	}
 
 /**
- * Main ACL check function. Checks to see if the ARO (access request object) has access to the 
- * ACO (access control object).Looks at the acl.ini.php file for permissions 
+ * Main ACL check function. Checks to see if the ARO (access request object) has access to the
+ * ACO (access control object).Looks at the acl.ini.php file for permissions
  * (see instructions in /config/acl.ini.php).
  *
  * @param string $aro ARO
@@ -597,10 +597,10 @@ class IniAcl extends Object implements AclInterface {
  */
 	public function check($aro, $aco, $aco_action = null) {
 		if ($this->config == null) {
-			$this->config = $this->readConfigFile(CONFIGS . 'acl.ini.php');
+			$this->config = $this->readConfigFile(APP . 'Config' . DS . 'acl.ini.php');
 		}
 		$aclConfig = $this->config;
-		
+
 		if (is_array($aro)) {
 			$aro = Set::classicExtract($aro, $this->userPath);
 		}

+ 4 - 4
lib/Cake/Core/Configure.php

@@ -69,14 +69,14 @@ class Configure {
 				'www_root' => WWW_ROOT
 			));
 
-			if (!include(CONFIGS . 'core.php')) {
-				trigger_error(__d('cake_dev', "Can't find application core file. Please create %score.php, and make sure it is readable by PHP.", CONFIGS), E_USER_ERROR);
+			if (!include(APP . 'Config' . DS . 'core.php')) {
+				trigger_error(__d('cake_dev', "Can't find application core file. Please create %score.php, and make sure it is readable by PHP.", APP . 'Config' . DS), E_USER_ERROR);
 			}
 
 			App::init();
 			App::build();
-			if (!include(CONFIGS . 'bootstrap.php')) {
-				trigger_error(__d('cake_dev', "Can't find application bootstrap file. Please create %sbootstrap.php, and make sure it is readable by PHP.", CONFIGS), E_USER_ERROR);
+			if (!include(APP . 'Config' . DS . 'bootstrap.php')) {
+				trigger_error(__d('cake_dev', "Can't find application bootstrap file. Please create %sbootstrap.php, and make sure it is readable by PHP.", APP . 'Config' . DS), E_USER_ERROR);
 			}
 			$level = -1;
 			if (isset(self::$_values['Error']['level'])) {

+ 2 - 2
lib/Cake/Model/CakeSchema.php

@@ -94,7 +94,7 @@ class CakeSchema extends Object {
 		}
 
 		if (empty($options['path'])) {
-			$this->path = CONFIGS . 'Schema';
+			$this->path = APP . 'Config' . 'Schema';
 		}
 
 		$options = array_merge(get_object_vars($this), $options);
@@ -277,7 +277,7 @@ class CakeSchema extends Object {
 									if (in_array($withTable, $currentTables)) {
 										$key = array_search($withTable, $currentTables);
 										$noPrefixWith = str_replace($prefix, '', $withTable);
-	
+
 										$tables[$noPrefixWith] = $this->__columns($Object->$class);
 										$tables[$noPrefixWith]['indexes'] = $db->index($Object->$class);
 										$tables[$noPrefixWith]['tableParameters'] = $db->readTableParameters($withTable);

+ 2 - 2
lib/Cake/Model/ConnectionManager.php

@@ -65,7 +65,7 @@ class ConnectionManager {
  *
  */
 	private static function init() {
-		include_once CONFIGS . 'database.php';
+		include_once APP . 'Config' . DS . 'database.php';
 		if (class_exists('DATABASE_CONFIG')) {
 			self::$config = new DATABASE_CONFIG();
 		}
@@ -265,4 +265,4 @@ class ConnectionManager {
 			session_write_close();
 		}
 	}
-}
+}

+ 3 - 3
lib/Cake/Network/Email/CakeEmail.php

@@ -46,7 +46,7 @@ class CakeEmail {
 	const LINE_LENGTH_SHOULD = 78;
 
 /**
- * Line length - no must more - RFC 2822 - 2.1.1 
+ * Line length - no must more - RFC 2822 - 2.1.1
  *
  * @constant LINE_LENGTH_MUST
  */
@@ -890,7 +890,7 @@ class CakeEmail {
 	public function send($content = null) {
 		if (is_string($this->_config)) {
 			if (!config('email')) {
-				throw new SocketException(__d('cake', '%s not found.', CONFIGS . 'email.php'));
+				throw new SocketException(__d('cake', '%s not found.', APP . 'Config' . 'email.php'));
 			}
 			$configs = new EmailConfig();
 			if (!isset($configs->{$this->_config})) {
@@ -971,7 +971,7 @@ class CakeEmail {
 
 		if (is_string($transportConfig)) {
 			if (!config('email')) {
-				throw new SocketException(__d('cake', '%s not found.', CONFIGS . 'email.php'));
+				throw new SocketException(__d('cake', '%s not found.', APP . 'Config' . 'email.php'));
 			}
 			$configs = new EmailConfig();
 			if (!isset($configs->{$transportConfig})) {

+ 5 - 5
lib/Cake/Routing/Dispatcher.php

@@ -33,7 +33,7 @@ App::uses('Debugger', 'Utility');
 
 /**
  * Dispatcher converts Requests into controller actions.  It uses the dispatched Request
- * to locate and load the correct controller.  If found, the requested action is called on 
+ * to locate and load the correct controller.  If found, the requested action is called on
  * the controller.
  *
  * @package       cake
@@ -64,7 +64,7 @@ class Dispatcher {
  * to autoRender, via Controller::$autoRender, then Dispatcher will render the view.
  *
  * Actions in CakePHP can be any public method on a controller, that is not declared in Controller.  If you
- * want controller methods to be public and in-accesible by URL, then prefix them with a `_`.  
+ * want controller methods to be public and in-accesible by URL, then prefix them with a `_`.
  * For example `public function _loadPosts() { }` would not be accessible via URL.  Private and protected methods
  * are also not accessible via URL.
  *
@@ -103,7 +103,7 @@ class Dispatcher {
 	}
 
 /**
- * Check if the request's action is marked as private, with an underscore, of if the request is attempting to 
+ * Check if the request's action is marked as private, with an underscore, of if the request is attempting to
  * directly accessing a prefixed action.
  *
  * @param CakeRequest $request The request to check
@@ -236,7 +236,7 @@ class Dispatcher {
  * @return void
  */
 	protected function _loadRoutes() {
-		include CONFIGS . 'routes.php';
+		include APP . 'Config' . DS . 'routes.php';
 	}
 
 /**
@@ -278,7 +278,7 @@ class Dispatcher {
 		}
 		$filters = Configure::read('Asset.filter');
 		$isCss = (
-			strpos($url, 'ccss/') === 0 || 
+			strpos($url, 'ccss/') === 0 ||
 			preg_match('#^(theme/([^/]+)/ccss/)|(([^/]+)(?<!css)/ccss)/#i', $url)
 		);
 		$isJs = (

+ 1 - 1
lib/Cake/Test/Case/Console/Command/SchemaShellTest.php

@@ -400,7 +400,7 @@ class SchemaShellTest extends CakeTestCase {
 		$this->Shell->params = array(
 			'connection' => 'test',
 			'name' => 'DbAcl',
-			'path' => CONFIGS . 'schema'
+			'path' => APP . 'Config' . DS . 'schema'
 		);
 		$this->Shell->args = array('DbAcl', 'acos');
 		$this->Shell->startup();

+ 1 - 1
lib/Cake/Test/Case/Console/Command/Task/ProjectTaskTest.php

@@ -220,7 +220,7 @@ class ProjectTaskTest extends CakeTestCase {
  * @return void
  */
 	public function testCakeAdmin() {
-		$file = new File(CONFIGS . 'core.php');
+		$file = new File(APP . 'Config' . DS . 'core.php');
 		$contents = $file->read();;
 		$file = new File(TMP . 'tests' . DS . 'core.php');
 		$file->write($contents);

+ 2 - 2
lib/Cake/Test/test_app/View/Pages/home.ctp

@@ -49,7 +49,7 @@ App::uses('Debugger', 'Utility');
 <p>
 	<?php
 		$filePresent = null;
-		if (file_exists(CONFIGS.'database.php')):
+		if (file_exists(APP . 'Config' . DS.'database.php')):
 			echo '<span class="notice success">';
 				echo __d('cake_dev', 'Your database configuration file is present.');
 				$filePresent = true;
@@ -160,4 +160,4 @@ You can also add some CSS styles for your pages at: APP/webroot/css.');
 	<ul><li><?php echo __d('cake_dev', 'Recommended Software Books'); ?></li></ul></li>
 	<li><a href="http://www.cafepress.com/cakefoundation"><?php echo __d('cake_dev', 'CakePHP gear'); ?> </a>
 	<ul><li><?php echo __d('cake_dev', 'Get your own CakePHP gear - Doughnate to Cake'); ?></li></ul></li>
-</ul>
+</ul>

+ 1 - 1
lib/Cake/Test/test_app/View/Posts/test_nocache_tags.ctp

@@ -62,7 +62,7 @@
 		<?php
 			echo __d('cake', 'Your database configuration file is ');
 			$filePresent = null;
-			if (file_exists(CONFIGS.'database.php')):
+			if (file_exists(APP . 'Config'.'database.php')):
 				echo __d('cake', 'present.');
 				$filePresent = true;
 			else:

+ 2 - 2
lib/Cake/View/Helper/HtmlHelper.php

@@ -648,7 +648,7 @@ class HtmlHelper extends AppHelper {
 			return null;
 		}
 	}
-	
+
 /**
  * Creates a formatted IMG element. If `$options['url']` is provided, an image link will be
  * generated with the link pointed at `$options['url']`.  This method will set an empty
@@ -928,7 +928,7 @@ class HtmlHelper extends AppHelper {
  * @param string $path Path with config file
  * @return mixed False to error or loaded configs
  */
-	public function loadConfig($configFile, $path = CONFIGS) {
+	public function loadConfig($configFile, $path = APP . 'Config' . DS) {
 		$file = null;
 		$reader = 'php';
 

+ 2 - 2
lib/Cake/View/Pages/home.ctp

@@ -57,7 +57,7 @@ endif;
 <p>
 	<?php
 		$filePresent = null;
-		if (file_exists(CONFIGS.'database.php')):
+		if (file_exists(APP . 'Config' . DS 'database.php')):
 			echo '<span class="notice success">';
 				echo __d('cake_dev', 'Your database configuration file is present.');
 				$filePresent = true;
@@ -168,4 +168,4 @@ You can also add some CSS styles for your pages at: APP/webroot/css.');
 	<ul><li><?php echo __d('cake_dev', 'Recommended Software Books'); ?></li></ul></li>
 	<li><a href="http://www.cafepress.com/cakefoundation"><?php echo __d('cake_dev', 'CakePHP gear'); ?> </a>
 	<ul><li><?php echo __d('cake_dev', 'Get your own CakePHP gear - Doughnate to Cake'); ?></li></ul></li>
-</ul>
+</ul>

+ 4 - 4
lib/Cake/basics.php

@@ -44,10 +44,10 @@
 function config() {
 	$args = func_get_args();
 	foreach ($args as $arg) {
-		if ($arg === 'database' && file_exists(CONFIGS . 'database.php')) {
-			include_once(CONFIGS . $arg . '.php');
-		} elseif (file_exists(CONFIGS . $arg . '.php')) {
-			include_once(CONFIGS . $arg . '.php');
+		if ($arg === 'database' && file_exists(APP . 'Config' . 'database.php')) {
+			include_once(APP . 'Config' . $arg . '.php');
+		} elseif (file_exists(APP . 'Config' . $arg . '.php')) {
+			include_once(APP . 'Config' . $arg . '.php');
 
 			if (count($args) == 1) {
 				return true;

+ 0 - 7
lib/Cake/bootstrap.php

@@ -54,13 +54,6 @@ if (!defined('APP')) {
 	define('APPLIBS', APP.'Lib'.DS);
 
 /**
- * Path to the configuration files directory.
- */
-if (!defined('CONFIGS')) {
-	define('CONFIGS', APP.'Config'.DS);
-}
-
-/**
  * Path to the public CSS directory.
  */
 	define('CSS', WWW_ROOT.'css'.DS);

+ 2 - 2
lib/Cake/tests/test_app/View/posts/test_nocache_tags.ctp

@@ -62,7 +62,7 @@
 		<?php
 			echo __d('cake', 'Your database configuration file is ');
 			$filePresent = null;
-			if (file_exists(CONFIGS.'database.php')):
+			if (file_exists(APP . 'Config' . DS.'database.php')):
 				echo __d('cake', 'present.');
 				$filePresent = true;
 			else:
@@ -139,4 +139,4 @@ if (!empty($filePresent)):
 	<ul><li><?php __d('cake', 'Community mailing list'); ?></li></ul></li>
 	<li><a href="irc://irc.freenode.net/cakephp">irc.freenode.net #cakephp</a>
 	<ul><li><?php __d('cake', 'Live chat about CakePHP'); ?></li></ul></li>
-</ul>
+</ul>