Skip to content

Commit

Permalink
upgrade shell - refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
evilbloodydemon committed Dec 11, 2010
1 parent 65269bb commit d414755
Showing 1 changed file with 17 additions and 21 deletions.
38 changes: 17 additions & 21 deletions cake/console/shells/upgrade.php
Expand Up @@ -18,13 +18,9 @@ class UpgradeShell extends Shell {
* @return void
*/
function helpers() {
if (!empty($this->params['plugin'])) {
$this->_paths = array(App::pluginPath($this->params['plugin']));
} else {
$this->_paths = array(
VIEWS
);
}
$this->_paths = array(
VIEWS
);

$patterns = array();
foreach(App::objects('helper') as $helper) {
Expand All @@ -36,11 +32,7 @@ function helpers() {
);
}

$this->_findFiles();
foreach ($this->_files as $file) {
$this->out('Updating ' . $file . '...', 1, Shell::VERBOSE);
$this->_updateFile($file, $patterns);
}
$this->_filesRegexpUpdate($patterns);
}

/**
Expand All @@ -51,15 +43,11 @@ function helpers() {
* @return void
*/
function i18n() {
if (!empty($this->params['plugin'])) {
$this->_paths = array(App::pluginPath($this->params['plugin']));
} else {
$this->_paths = array(
CONTROLLERS,
MODELS,
VIEWS
);
}
$this->_paths = array(
CONTROLLERS,
MODELS,
VIEWS
);

$patterns = array(
array(
Expand All @@ -75,6 +63,14 @@ function i18n() {
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();
foreach ($this->_files as $file) {
$this->out('Updating ' . $file . '...', 1, Shell::VERBOSE);
Expand Down

0 comments on commit d414755

Please sign in to comment.