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 4d00b2aeefc..0a0574c61f6 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 @@ public function read($key) { } 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 2a4c72e4547..c9b01fa8eeb 100644 --- a/lib/Cake/Console/Command/AclShell.php +++ b/lib/Cake/Console/Command/AclShell.php @@ -20,7 +20,7 @@ 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 @@ public function startup() { $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 @@ public function initdb() { */ 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 099c3921f2b..aed3598b10f 100644 --- a/lib/Cake/Console/Command/ConsoleShell.php +++ b/lib/Cake/Console/Command/ConsoleShell.php @@ -339,7 +339,7 @@ protected function _loadRoutes() { 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 27b26f72804..d03b58f3719 100644 --- a/lib/Cake/Console/Command/SchemaShell.php +++ b/lib/Cake/Console/Command/SchemaShell.php @@ -440,7 +440,7 @@ public function getOptionParser() { ); $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 9793be3b2e4..bfa87f167a6 100644 --- a/lib/Cake/Console/Command/Task/ProjectTask.php +++ b/lib/Cake/Console/Command/Task/ProjectTask.php @@ -82,14 +82,14 @@ public function execute() { 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 @@ public function corePath($path) { * @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 506563c9120..84e21fae82c 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 5d2348e5268..69a7f93ca54 100644 --- a/lib/Cake/Controller/Component/AclComponent.php +++ b/lib/Cake/Controller/Component/AclComponent.php @@ -238,8 +238,8 @@ public function initialize($component); } /** - * 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 @@ protected function _getAcoKeys($keys) { } /** - * 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 @@ public function initialize($component) { * @return boolean Success */ public function allow($aro, $aco, $action = "*") { - + } /** @@ -570,7 +570,7 @@ public function allow($aro, $aco, $action = "*") { * @return boolean Success */ public function deny($aro, $aco, $action = "*") { - + } /** @@ -582,12 +582,12 @@ public function deny($aro, $aco, $action = "*") { * @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 @@ public function inherit($aro, $aco, $action = "*") { */ 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 65fd12f831c..40671621db1 100644 --- a/lib/Cake/Core/Configure.php +++ b/lib/Cake/Core/Configure.php @@ -69,14 +69,14 @@ public static function bootstrap($boot = true) { '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 9080d52b130..e26218c22ca 100644 --- a/lib/Cake/Model/CakeSchema.php +++ b/lib/Cake/Model/CakeSchema.php @@ -94,7 +94,7 @@ function __construct($options = array()) { } 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 @@ public function read($options = array()) { 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 914e8911afd..1fbc25751ff 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 @@ public static function shutdown() { 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 e2cf36e9b2c..8cd0ba1ebda 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 @@ public function config($config = null) { 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 @@ public static function deliver($to = null, $subject = null, $message = null, $tr 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 53f24a76542..1879bac95f6 100644 --- a/lib/Cake/Routing/Dispatcher.php +++ b/lib/Cake/Routing/Dispatcher.php @@ -33,7 +33,7 @@ /** * 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 @@ public function __construct($url = null, $base = false) { * 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 @@ public function dispatch(CakeRequest $request, $additionalParams = array()) { } /** - * 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 @@ protected function _loadController($request) { * @return void */ protected function _loadRoutes() { - include CONFIGS . 'routes.php'; + include APP . 'Config' . DS . 'routes.php'; } /** @@ -278,7 +278,7 @@ public function asset($url) { } $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 f6017c44674..8d0bd27de0d 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 @@ public function testGetPrefix() { * @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 a26cfdb0b5a..1473e9579a8 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 91e85702d6e..1d5ee6767d5 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 4bea45d86e4..e197d55b2bb 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 ffd9b121301..741d8ab4086 100644 --- a/lib/Cake/bootstrap.php +++ b/lib/Cake/bootstrap.php @@ -53,13 +53,6 @@ */ 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 20909edc5dd..5cd1e98e054 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 +