remove CONFIGS constant

This commit is contained in:
AD7six 2011-04-17 13:13:02 +02:00
parent 9e0e19c5ac
commit 0cb70ae3bb
21 changed files with 61 additions and 65 deletions

View file

@ -34,9 +34,12 @@ class PhpReader implements ConfigReaderInterface {
/** /**
* Constructor for PHP Config file reading. * 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; $this->_path = $path;
} }
@ -81,4 +84,4 @@ class PhpReader implements ConfigReaderInterface {
} }
return $config; return $config;
} }
} }

View file

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

View file

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

View file

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

View file

@ -82,14 +82,14 @@ class ProjectTask extends Shell {
if ($this->securitySalt($path) === true) { if ($this->securitySalt($path) === true) {
$this->out(__d('cake_console', ' * Random hash key created for \'Security.salt\'')); $this->out(__d('cake_console', ' * Random hash key created for \'Security.salt\''));
} else { } 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; $success = false;
} }
if ($this->securityCipherSeed($path) === true) { if ($this->securityCipherSeed($path) === true) {
$this->out(__d('cake_console', ' * Random seed created for \'Security.cipherSeed\'')); $this->out(__d('cake_console', ' * Random seed created for \'Security.cipherSeed\''));
} else { } 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; $success = false;
} }
@ -313,7 +313,7 @@ class ProjectTask extends Shell {
* @return boolean Success * @return boolean Success
*/ */
public function cakeAdmin($name) { 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'); $File = new File($path . 'core.php');
$contents = $File->read(); $contents = $File->read();
if (preg_match('%(\s*[/]*Configure::write\(\'Routing.prefixes\',[\s\'a-z,\)\(]*\);)%', $contents, $match)) { if (preg_match('%(\s*[/]*Configure::write\(\'Routing.prefixes\',[\s\'a-z,\)\(]*\);)%', $contents, $match)) {

View file

@ -37,7 +37,7 @@ endif;
<p> <p>
<?php <?php
\$filePresent = null; \$filePresent = null;
if (file_exists(CONFIGS . 'database.php')): if (file_exists(APP . 'Config' . DS . 'database.php')):
echo '<span class=\"notice success\">'; echo '<span class=\"notice success\">';
echo __('Your database configuration file is present.'); echo __('Your database configuration file is present.');
\$filePresent = true; \$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 .= "\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 .= "?>\n";
$output .= "</p>\n"; $output .= "</p>\n";
?> ?>

View file

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

View file

@ -69,14 +69,14 @@ class Configure {
'www_root' => WWW_ROOT 'www_root' => WWW_ROOT
)); ));
if (!include(CONFIGS . 'core.php')) { 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.", CONFIGS), E_USER_ERROR); 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::init();
App::build(); App::build();
if (!include(CONFIGS . 'bootstrap.php')) { 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.", CONFIGS), E_USER_ERROR); 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; $level = -1;
if (isset(self::$_values['Error']['level'])) { if (isset(self::$_values['Error']['level'])) {

View file

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

View file

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

View file

@ -46,7 +46,7 @@ class CakeEmail {
const LINE_LENGTH_SHOULD = 78; 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 * @constant LINE_LENGTH_MUST
*/ */
@ -890,7 +890,7 @@ class CakeEmail {
public function send($content = null) { public function send($content = null) {
if (is_string($this->_config)) { if (is_string($this->_config)) {
if (!config('email')) { 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(); $configs = new EmailConfig();
if (!isset($configs->{$this->_config})) { if (!isset($configs->{$this->_config})) {
@ -971,7 +971,7 @@ class CakeEmail {
if (is_string($transportConfig)) { if (is_string($transportConfig)) {
if (!config('email')) { 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(); $configs = new EmailConfig();
if (!isset($configs->{$transportConfig})) { if (!isset($configs->{$transportConfig})) {

View file

@ -33,7 +33,7 @@ App::uses('Debugger', 'Utility');
/** /**
* Dispatcher converts Requests into controller actions. It uses the dispatched Request * 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. * the controller.
* *
* @package cake * @package cake
@ -64,7 +64,7 @@ class Dispatcher {
* to autoRender, via Controller::$autoRender, then Dispatcher will render the view. * 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 * 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 * For example `public function _loadPosts() { }` would not be accessible via URL. Private and protected methods
* are also not accessible via URL. * 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. * directly accessing a prefixed action.
* *
* @param CakeRequest $request The request to check * @param CakeRequest $request The request to check
@ -236,7 +236,7 @@ class Dispatcher {
* @return void * @return void
*/ */
protected function _loadRoutes() { protected function _loadRoutes() {
include CONFIGS . 'routes.php'; include APP . 'Config' . DS . 'routes.php';
} }
/** /**
@ -278,7 +278,7 @@ class Dispatcher {
} }
$filters = Configure::read('Asset.filter'); $filters = Configure::read('Asset.filter');
$isCss = ( $isCss = (
strpos($url, 'ccss/') === 0 || strpos($url, 'ccss/') === 0 ||
preg_match('#^(theme/([^/]+)/ccss/)|(([^/]+)(?<!css)/ccss)/#i', $url) preg_match('#^(theme/([^/]+)/ccss/)|(([^/]+)(?<!css)/ccss)/#i', $url)
); );
$isJs = ( $isJs = (

View file

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

View file

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

View file

@ -49,7 +49,7 @@ App::uses('Debugger', 'Utility');
<p> <p>
<?php <?php
$filePresent = null; $filePresent = null;
if (file_exists(CONFIGS.'database.php')): if (file_exists(APP . 'Config' . DS.'database.php')):
echo '<span class="notice success">'; echo '<span class="notice success">';
echo __d('cake_dev', 'Your database configuration file is present.'); echo __d('cake_dev', 'Your database configuration file is present.');
$filePresent = true; $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> <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> <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><li><?php echo __d('cake_dev', 'Get your own CakePHP gear - Doughnate to Cake'); ?></li></ul></li>
</ul> </ul>

View file

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

View file

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

View file

@ -57,7 +57,7 @@ endif;
<p> <p>
<?php <?php
$filePresent = null; $filePresent = null;
if (file_exists(CONFIGS.'database.php')): if (file_exists(APP . 'Config' . DS 'database.php')):
echo '<span class="notice success">'; echo '<span class="notice success">';
echo __d('cake_dev', 'Your database configuration file is present.'); echo __d('cake_dev', 'Your database configuration file is present.');
$filePresent = true; $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> <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> <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><li><?php echo __d('cake_dev', 'Get your own CakePHP gear - Doughnate to Cake'); ?></li></ul></li>
</ul> </ul>

View file

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

View file

@ -53,13 +53,6 @@ if (!defined('APP')) {
*/ */
define('APPLIBS', APP.'Lib'.DS); 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. * Path to the public CSS directory.
*/ */

View file

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