mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Adding upgrade command for fixing request object access.
This commit is contained in:
parent
6a5d6908d8
commit
e80d45dd8f
1 changed files with 50 additions and 0 deletions
|
@ -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
|
||||
));
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue