mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-17 04:18:24 +00:00
upgrade shell - refactoring
This commit is contained in:
parent
65269bba19
commit
d414755036
1 changed files with 17 additions and 21 deletions
|
@ -18,13 +18,9 @@ class UpgradeShell extends Shell {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function helpers() {
|
function helpers() {
|
||||||
if (!empty($this->params['plugin'])) {
|
$this->_paths = array(
|
||||||
$this->_paths = array(App::pluginPath($this->params['plugin']));
|
VIEWS
|
||||||
} else {
|
);
|
||||||
$this->_paths = array(
|
|
||||||
VIEWS
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
$patterns = array();
|
$patterns = array();
|
||||||
foreach(App::objects('helper') as $helper) {
|
foreach(App::objects('helper') as $helper) {
|
||||||
|
@ -36,11 +32,7 @@ class UpgradeShell extends Shell {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_findFiles();
|
$this->_filesRegexpUpdate($patterns);
|
||||||
foreach ($this->_files as $file) {
|
|
||||||
$this->out('Updating ' . $file . '...', 1, Shell::VERBOSE);
|
|
||||||
$this->_updateFile($file, $patterns);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -51,15 +43,11 @@ class UpgradeShell extends Shell {
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function i18n() {
|
function i18n() {
|
||||||
if (!empty($this->params['plugin'])) {
|
$this->_paths = array(
|
||||||
$this->_paths = array(App::pluginPath($this->params['plugin']));
|
CONTROLLERS,
|
||||||
} else {
|
MODELS,
|
||||||
$this->_paths = array(
|
VIEWS
|
||||||
CONTROLLERS,
|
);
|
||||||
MODELS,
|
|
||||||
VIEWS
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
$patterns = array(
|
$patterns = array(
|
||||||
array(
|
array(
|
||||||
|
@ -75,6 +63,14 @@ class UpgradeShell extends Shell {
|
||||||
array('__*(*, true) to __*(*)', '/(__[a-z]*\(.*?)(,\s*true)(\))/', '\1\3')
|
array('__*(*, true) to __*(*)', '/(__[a-z]*\(.*?)(,\s*true)(\))/', '\1\3')
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$this->_filesRegexpUpdate($patterns);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function _filesRegexpUpdate($patterns) {
|
||||||
|
if (!empty($this->params['plugin'])) {
|
||||||
|
$this->_paths = array(App::pluginPath($this->params['plugin']));
|
||||||
|
}
|
||||||
|
|
||||||
$this->_findFiles();
|
$this->_findFiles();
|
||||||
foreach ($this->_files as $file) {
|
foreach ($this->_files as $file) {
|
||||||
$this->out('Updating ' . $file . '...', 1, Shell::VERBOSE);
|
$this->out('Updating ' . $file . '...', 1, Shell::VERBOSE);
|
||||||
|
|
Loading…
Reference in a new issue