From f7a81a9aeea0d9f3c9c56cbe703fba3c60caa217 Mon Sep 17 00:00:00 2001 From: mark_story Date: Mon, 19 Aug 2013 10:40:09 -0400 Subject: [PATCH] Conditionally define constants in the CLI environment. 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 --- lib/Cake/Console/ShellDispatcher.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/Cake/Console/ShellDispatcher.php b/lib/Cake/Console/ShellDispatcher.php index b64f0abd2..cb6711e90 100644 --- a/lib/Cake/Console/ShellDispatcher.php +++ b/lib/Cake/Console/ShellDispatcher.php @@ -119,9 +119,15 @@ class ShellDispatcher { * @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); }