From 8ff4ae273cccfff1c5899f5d9e7a3e742982fe8f Mon Sep 17 00:00:00 2001 From: gwoo Date: Tue, 17 Jun 2008 05:06:05 +0000 Subject: [PATCH] proper fix for #4931 git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7202 3807eeeb-6ff5-0310-8944-8be069107fe0 --- cake/console/cake.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/cake/console/cake.php b/cake/console/cake.php index ec6e52efb..a7523fb9c 100644 --- a/cake/console/cake.php +++ b/cake/console/cake.php @@ -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',