Skip to content

Commit

Permalink
Conditionally define constants in the CLI environment.
Browse files Browse the repository at this point in the history
Only define constants if they don't already exist. Users can modify
`app/Console/cake.php` and define constants before this code executes.

Fixes #4000
  • Loading branch information
markstory committed Aug 19, 2013
1 parent 675f828 commit f7a81a9
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/Cake/Console/ShellDispatcher.php
Expand Up @@ -119,9 +119,15 @@ protected function _initEnvironment() {
* @return boolean Success.
*/
protected function _bootstrap() {
define('ROOT', $this->params['root']);
define('APP_DIR', $this->params['app']);
define('APP', $this->params['working'] . DS);
if (!defined('ROOT')) {
define('ROOT', $this->params['root']);
}
if (!defined('APP_DIR')) {
define('APP_DIR', $this->params['app']);
}
if (!defined('APP')) {
define('APP', $this->params['working'] . DS);
}
if (!defined('WWW_ROOT')) {
define('WWW_ROOT', APP . $this->params['webroot'] . DS);
}
Expand Down

0 comments on commit f7a81a9

Please sign in to comment.