From 0cb70ae3bb22c40fcf69c8882c1d48657cce5bed Mon Sep 17 00:00:00 2001 From: AD7six Date: Sun, 17 Apr 2011 13:13:02 +0200 Subject: [PATCH] remove CONFIGS constant --- lib/Cake/Configure/PhpReader.php | 9 ++++--- lib/Cake/Console/Command/AclShell.php | 10 ++++---- lib/Cake/Console/Command/ConsoleShell.php | 2 +- lib/Cake/Console/Command/SchemaShell.php | 2 +- lib/Cake/Console/Command/Task/ProjectTask.php | 6 ++--- .../Console/templates/default/views/home.ctp | 4 ++-- .../Controller/Component/AclComponent.php | 24 +++++++++---------- lib/Cake/Core/Configure.php | 8 +++---- lib/Cake/Model/CakeSchema.php | 4 ++-- lib/Cake/Model/ConnectionManager.php | 4 ++-- lib/Cake/Network/Email/CakeEmail.php | 6 ++--- lib/Cake/Routing/Dispatcher.php | 10 ++++---- .../Case/Console/Command/SchemaShellTest.php | 2 +- .../Console/Command/Task/ProjectTaskTest.php | 2 +- lib/Cake/Test/test_app/View/Pages/home.ctp | 4 ++-- .../test_app/View/Posts/test_nocache_tags.ctp | 2 +- lib/Cake/View/Helper/HtmlHelper.php | 4 ++-- lib/Cake/View/Pages/home.ctp | 4 ++-- lib/Cake/basics.php | 8 +++---- lib/Cake/bootstrap.php | 7 ------ .../test_app/View/posts/test_nocache_tags.ctp | 4 ++-- 21 files changed, 61 insertions(+), 65 deletions(-) diff --git a/lib/Cake/Configure/PhpReader.php b/lib/Cake/Configure/PhpReader.php index 4d00b2aee..0a0574c61 100644 --- a/lib/Cake/Configure/PhpReader.php +++ b/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; } -} \ No newline at end of file +} diff --git a/lib/Cake/Console/Command/AclShell.php b/lib/Cake/Console/Command/AclShell.php index 2a4c72e45..c9b01fa8e 100644 --- a/lib/Cake/Console/Command/AclShell.php +++ b/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'), diff --git a/lib/Cake/Console/Command/ConsoleShell.php b/lib/Cake/Console/Command/ConsoleShell.php index 099c3921f..aed3598b1 100644 --- a/lib/Cake/Console/Command/ConsoleShell.php +++ b/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('/'); diff --git a/lib/Cake/Console/Command/SchemaShell.php b/lib/Cake/Console/Command/SchemaShell.php index 27b26f728..d03b58f37 100644 --- a/lib/Cake/Console/Command/SchemaShell.php +++ b/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.'), diff --git a/lib/Cake/Console/Command/Task/ProjectTask.php b/lib/Cake/Console/Command/Task/ProjectTask.php index 9793be3b2..bfa87f167 100644 --- a/lib/Cake/Console/Command/Task/ProjectTask.php +++ b/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)) { diff --git a/lib/Cake/Console/templates/default/views/home.ctp b/lib/Cake/Console/templates/default/views/home.ctp index 506563c91..84e21fae8 100644 --- a/lib/Cake/Console/templates/default/views/home.ctp +++ b/lib/Cake/Console/templates/default/views/home.ctp @@ -37,7 +37,7 @@ endif;

'; 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.
', APP . 'View' . DS . 'Layouts' . DS . 'default.ctp.
', APP . 'webroot' . DS . 'css');\n"; $output .= "?>\n"; $output .= "

\n"; -?> \ No newline at end of file +?> diff --git a/lib/Cake/Controller/Component/AclComponent.php b/lib/Cake/Controller/Component/AclComponent.php index 5d2348e52..69a7f93ca 100644 --- a/lib/Cake/Controller/Component/AclComponent.php +++ b/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); } diff --git a/lib/Cake/Core/Configure.php b/lib/Cake/Core/Configure.php index 65fd12f83..40671621d 100644 --- a/lib/Cake/Core/Configure.php +++ b/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'])) { diff --git a/lib/Cake/Model/CakeSchema.php b/lib/Cake/Model/CakeSchema.php index 9080d52b1..e26218c22 100644 --- a/lib/Cake/Model/CakeSchema.php +++ b/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); diff --git a/lib/Cake/Model/ConnectionManager.php b/lib/Cake/Model/ConnectionManager.php index 914e8911a..1fbc25751 100644 --- a/lib/Cake/Model/ConnectionManager.php +++ b/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(); } } -} \ No newline at end of file +} diff --git a/lib/Cake/Network/Email/CakeEmail.php b/lib/Cake/Network/Email/CakeEmail.php index e2cf36e9b..8cd0ba1eb 100644 --- a/lib/Cake/Network/Email/CakeEmail.php +++ b/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})) { diff --git a/lib/Cake/Routing/Dispatcher.php b/lib/Cake/Routing/Dispatcher.php index 53f24a765..1879bac95 100644 --- a/lib/Cake/Routing/Dispatcher.php +++ b/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/)|(([^/]+)(?Shell->params = array( 'connection' => 'test', 'name' => 'DbAcl', - 'path' => CONFIGS . 'schema' + 'path' => APP . 'Config' . DS . 'schema' ); $this->Shell->args = array('DbAcl', 'acos'); $this->Shell->startup(); diff --git a/lib/Cake/Test/Case/Console/Command/Task/ProjectTaskTest.php b/lib/Cake/Test/Case/Console/Command/Task/ProjectTaskTest.php index f6017c446..8d0bd27de 100644 --- a/lib/Cake/Test/Case/Console/Command/Task/ProjectTaskTest.php +++ b/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); diff --git a/lib/Cake/Test/test_app/View/Pages/home.ctp b/lib/Cake/Test/test_app/View/Pages/home.ctp index a26cfdb0b..1473e9579 100644 --- a/lib/Cake/Test/test_app/View/Pages/home.ctp +++ b/lib/Cake/Test/test_app/View/Pages/home.ctp @@ -49,7 +49,7 @@ App::uses('Debugger', 'Utility');

'; 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.');

  • - \ No newline at end of file + diff --git a/lib/Cake/Test/test_app/View/Posts/test_nocache_tags.ctp b/lib/Cake/Test/test_app/View/Posts/test_nocache_tags.ctp index 91e85702d..1d5ee6767 100644 --- a/lib/Cake/Test/test_app/View/Posts/test_nocache_tags.ctp +++ b/lib/Cake/Test/test_app/View/Posts/test_nocache_tags.ctp @@ -62,7 +62,7 @@ '; 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.');
  • - \ No newline at end of file + diff --git a/lib/Cake/basics.php b/lib/Cake/basics.php index 4bea45d86..e197d55b2 100644 --- a/lib/Cake/basics.php +++ b/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; diff --git a/lib/Cake/bootstrap.php b/lib/Cake/bootstrap.php index ffd9b1213..741d8ab40 100644 --- a/lib/Cake/bootstrap.php +++ b/lib/Cake/bootstrap.php @@ -53,13 +53,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. */ diff --git a/lib/Cake/tests/test_app/View/posts/test_nocache_tags.ctp b/lib/Cake/tests/test_app/View/posts/test_nocache_tags.ctp index 20909edc5..5cd1e98e0 100644 --- a/lib/Cake/tests/test_app/View/posts/test_nocache_tags.ctp +++ b/lib/Cake/tests/test_app/View/posts/test_nocache_tags.ctp @@ -62,7 +62,7 @@
  • irc.freenode.net #cakephp
  • - \ No newline at end of file +