diff --git a/lib/Cake/Console/Command/UpgradeShell.php b/lib/Cake/Console/Command/UpgradeShell.php index 5d88d6bcd..699bcf4e1 100644 --- a/lib/Cake/Console/Command/UpgradeShell.php +++ b/lib/Cake/Console/Command/UpgradeShell.php @@ -500,6 +500,29 @@ class UpgradeShell extends AppShell { $this->_filesRegexpUpdate($patterns); } +/** + * Update controller redirects. + * + * - Make redirect statements return early. + * + * @return void + */ + public function controller_redirects() { + $this->_paths = App::Path('Controller'); + if (!empty($this->params['plugin'])) { + $this->_paths = App::Path('Controller', $this->params['plugin']); + } + $patterns = array( + array( + '$this->redirect() to return $this->redirect()', + '/\t\$this-\>redirect\(/', + "\t" . 'return $this->redirect(' + ), + ); + + $this->_filesRegexpUpdate($patterns); + } + /** * Update components. * @@ -840,6 +863,9 @@ class UpgradeShell extends AppShell { ))->addSubcommand('constants', array( 'help' => __d('cake_console', "Replace Obsolete constants"), 'parser' => $subcommandParser + ))->addSubcommand('controller_redirects', array( + 'help' => __d('cake_console', 'Return early on controller redirect calls.'), + 'parser' => $subcommandParser ))->addSubcommand('components', array( 'help' => __d('cake_console', 'Update components to extend Component class.'), 'parser' => $subcommandParser