Skip to content

Commit

Permalink
don't fail if the dir doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
AD7six committed May 1, 2011
1 parent 0181f71 commit 20ff025
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions lib/Cake/Console/Command/UpgradeShell.php
Expand Up @@ -53,7 +53,7 @@ function helpers() {
"\\\$this->{$helper}->"
);
}

$this->_filesRegexpUpdate($patterns);
}

Expand Down Expand Up @@ -246,11 +246,14 @@ protected function _filesRegexpUpdate($patterns) {
/**
* Searches the paths and finds files based on extension.
*
* @param string $extensions
* @param string $extensions
* @return void
*/
protected function _findFiles($extensions = '') {
foreach ($this->_paths as $path) {
if (!is_dir($path)) {
continue;
}
$files = array();
$Iterator = new RegexIterator(
new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)),
Expand All @@ -275,7 +278,7 @@ protected function _findFiles($extensions = '') {
*/
protected function _updateFile($file, $patterns) {
$contents = file_get_contents($file);

foreach ($patterns as $pattern) {
$this->out(' * Updating ' . $pattern[0], 1, Shell::VERBOSE);
$contents = preg_replace($pattern[1], $pattern[2], $contents);
Expand Down Expand Up @@ -335,4 +338,4 @@ function getOptionParser() {
'parser' => $subcommandParser
));
}
}
}

0 comments on commit 20ff025

Please sign in to comment.