From e80d45dd8fd1ca67ab5ddaa2ead5dd09d17738ae Mon Sep 17 00:00:00 2001 From: mark_story Date: Sat, 11 Dec 2010 23:46:39 -0500 Subject: [PATCH] Adding upgrade command for fixing request object access. --- cake/console/shells/upgrade.php | 50 +++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/cake/console/shells/upgrade.php b/cake/console/shells/upgrade.php index 75e452335..a54899c95 100644 --- a/cake/console/shells/upgrade.php +++ b/cake/console/shells/upgrade.php @@ -138,7 +138,53 @@ class UpgradeShell extends Shell { 'microtime(true)' ), ); + $this->_filesRegexpUpdate($patterns); + } +/** + * Update the properties moved to CakeRequest. + * + * @return void + */ + public function request() { + $this->_paths = array( + APP + ); + if (!empty($this->params['plugin'])) { + $this->_paths = array(App::pluginPath($this->params['plugin'])); + } + $patterns = array( + array( + '$this->data -> $this->request->data', + '/(\$this->data)/', + '$this->request->data' + ), + array( + '$this->params -> $this->request->params', + '/(\$this->params)/', + '$this->request->params' + ), + array( + '$this->webroot -> $this->request->webroot', + '/(\$this->webroot)/', + '$this->request->webroot' + ), + array( + '$this->base -> $this->request->base', + '/(\$this->base)/', + '$this->request->base' + ), + array( + '$this->here -> $this->request->here', + '/(\$this->here)/', + '$this->request->here' + ), + array( + '$this->action -> $this->request->action', + '/(\$this->action)/', + '$this->request->action' + ), + ); $this->_filesRegexpUpdate($patterns); } @@ -231,6 +277,10 @@ class UpgradeShell extends Shell { ->addSubcommand('basics', array( 'help' => 'Update removed basics functions to PHP native functions.', 'parser' => $subcommandParser + )) + ->addSubcommand('request', array( + 'help' => 'Update removed request access, and replace with $this->request.', + 'parser' => $subcommandParser )); } } \ No newline at end of file