From 20ff0259d9db872dd919184f3cf0d6d9df5519a3 Mon Sep 17 00:00:00 2001 From: AD7six Date: Sun, 1 May 2011 19:32:09 +0200 Subject: [PATCH] don't fail if the dir doesn't exist --- lib/Cake/Console/Command/UpgradeShell.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/Cake/Console/Command/UpgradeShell.php b/lib/Cake/Console/Command/UpgradeShell.php index d8c8cc7a78b..7e0bfe0d9f0 100644 --- a/lib/Cake/Console/Command/UpgradeShell.php +++ b/lib/Cake/Console/Command/UpgradeShell.php @@ -53,7 +53,7 @@ function helpers() { "\\\$this->{$helper}->" ); } - + $this->_filesRegexpUpdate($patterns); } @@ -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)), @@ -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); @@ -335,4 +338,4 @@ function getOptionParser() { 'parser' => $subcommandParser )); } -} \ No newline at end of file +}