proper fix for #4931

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7202 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
gwoo 2008-06-17 05:06:05 +00:00
parent ccddcec642
commit 8ff4ae273c

View file

@ -127,8 +127,8 @@ class ShellDispatcher {
function __construct($args = array()) {
set_time_limit(0);
$this->__initConstants();
$this->__initEnvironment();
$this->parseParams($args);
$this->__initEnvironment();
$this->dispatch();
die("\n");
}
@ -154,6 +154,7 @@ class ShellDispatcher {
define('DISABLE_DEFAULT_ERROR_HANDLING', false);
define('CAKEPHP_SHELL', true);
}
require_once(CORE_PATH . 'cake' . DS . 'basics.php');
}
/**
* Defines current working environment.
@ -165,6 +166,13 @@ class ShellDispatcher {
$this->stdout = fopen('php://stdout', 'w');
$this->stderr = fopen('php://stderr', 'w');
if (!$this->__bootstrap()) {
$this->stderr("\nCakePHP Console: ");
$this->stderr("\nUnable to load Cake core:");
$this->stderr("\tMake sure " . DS . 'cake' . DS . 'libs exists in ' . CAKE_CORE_INCLUDE_PATH);
exit();
}
if (!isset($this->args[0]) || !isset($this->params['working'])) {
$this->stderr("\nCakePHP Console: ");
$this->stderr('This file has been loaded incorrectly and cannot continue.');
@ -182,13 +190,6 @@ class ShellDispatcher {
}
}
if (!$this->__bootstrap()) {
$this->stderr("\nCakePHP Console: ");
$this->stderr("\nUnable to load Cake core:");
$this->stderr("\tMake sure " . DS . 'cake' . DS . 'libs exists in ' . CAKE_CORE_INCLUDE_PATH);
exit();
}
$this->shiftArgs();
$this->shellPaths = array(
@ -211,7 +212,6 @@ class ShellDispatcher {
define('WWW_ROOT', APP_PATH . $this->params['webroot'] . DS);
$includes = array(
CORE_PATH . 'cake' . DS . 'basics.php',
CORE_PATH . 'cake' . DS . 'config' . DS . 'paths.php',
CORE_PATH . 'cake' . DS . 'libs' . DS . 'object.php',
CORE_PATH . 'cake' . DS . 'libs' . DS . 'inflector.php',