From 0a52326b0c08849f6303f5e7bfcf8f3caf4e49aa Mon Sep 17 00:00:00 2001 From: gwoo Date: Mon, 4 Jun 2007 19:07:50 +0000 Subject: [PATCH] fixing arg shifting in shells for php4 git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5240 3807eeeb-6ff5-0310-8944-8be069107fe0 --- cake/console/cake.php | 4 +--- cake/console/libs/shell.php | 6 +++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/cake/console/cake.php b/cake/console/cake.php index 498fc0916..8d1de0eff 100644 --- a/cake/console/cake.php +++ b/cake/console/cake.php @@ -280,10 +280,9 @@ class ShellDispatcher { $this->help(); } } - + $task = Inflector::camelize($command); if(in_array($task, $shell->taskNames)) { - $this->shiftArgs(); $shell->{$task}->initialize(); $shell->{$task}->loadTasks(); $shell->{$task}->startup(); @@ -313,7 +312,6 @@ class ShellDispatcher { } if($missingCommand && method_exists($shell, 'main')) { - $this->args = am(array($command), $this->args); $shell->startup(); $shell->main(); } else if($missingCommand && method_exists($shell, 'help')) { diff --git a/cake/console/libs/shell.php b/cake/console/libs/shell.php index 436eab214..9888fa207 100644 --- a/cake/console/libs/shell.php +++ b/cake/console/libs/shell.php @@ -127,10 +127,10 @@ class Shell extends Object { ClassRegistry::map($shellKey, $shellKey); if(!PHP5 && isset($this->args[0]) && strpos(low(get_class($this)), low(Inflector::camelize($this->args[0]))) !== false) { $dispatch->shiftArgs(); - } - if(!PHP5 && isset($this->args[0]) && low($this->command) == low(Inflector::variable($this->args[0]))) { + } + if(!PHP5 && isset($this->args[0]) && low($this->command) == low(Inflector::variable($this->args[0])) && method_exists($this, $this->command)) { $dispatch->shiftArgs(); - } + } $this->Dispatch =& $dispatch; } /**