mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 17:16:18 +00:00
don't fail if the dir doesn't exist
This commit is contained in:
parent
0181f71209
commit
20ff0259d9
1 changed files with 7 additions and 4 deletions
|
@ -53,7 +53,7 @@ class UpgradeShell extends Shell {
|
||||||
"\\\$this->{$helper}->"
|
"\\\$this->{$helper}->"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_filesRegexpUpdate($patterns);
|
$this->_filesRegexpUpdate($patterns);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,11 +246,14 @@ class UpgradeShell extends Shell {
|
||||||
/**
|
/**
|
||||||
* Searches the paths and finds files based on extension.
|
* Searches the paths and finds files based on extension.
|
||||||
*
|
*
|
||||||
* @param string $extensions
|
* @param string $extensions
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function _findFiles($extensions = '') {
|
protected function _findFiles($extensions = '') {
|
||||||
foreach ($this->_paths as $path) {
|
foreach ($this->_paths as $path) {
|
||||||
|
if (!is_dir($path)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
$files = array();
|
$files = array();
|
||||||
$Iterator = new RegexIterator(
|
$Iterator = new RegexIterator(
|
||||||
new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)),
|
new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)),
|
||||||
|
@ -275,7 +278,7 @@ class UpgradeShell extends Shell {
|
||||||
*/
|
*/
|
||||||
protected function _updateFile($file, $patterns) {
|
protected function _updateFile($file, $patterns) {
|
||||||
$contents = file_get_contents($file);
|
$contents = file_get_contents($file);
|
||||||
|
|
||||||
foreach ($patterns as $pattern) {
|
foreach ($patterns as $pattern) {
|
||||||
$this->out(' * Updating ' . $pattern[0], 1, Shell::VERBOSE);
|
$this->out(' * Updating ' . $pattern[0], 1, Shell::VERBOSE);
|
||||||
$contents = preg_replace($pattern[1], $pattern[2], $contents);
|
$contents = preg_replace($pattern[1], $pattern[2], $contents);
|
||||||
|
@ -335,4 +338,4 @@ class UpgradeShell extends Shell {
|
||||||
'parser' => $subcommandParser
|
'parser' => $subcommandParser
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue