Fixed Folder::delete method to recursively remove files and folders and causing Upgrade to fail.

This commit is contained in:
Djamil Legato
2016-07-19 11:16:13 -07:00
parent 4d43812c77
commit c0fcac3393
2 changed files with 11 additions and 16 deletions

View File

@@ -1,3 +1,9 @@
# v1.1.2
## 07/XX/2016
1. [](#bugfix)
* Fixed `Folder::delete` method to recursively remove files and folders and causing Upgrade to fail.
# v1.1.1
## 07/16/2016

View File

@@ -436,22 +436,11 @@ abstract class Folder
return @unlink($folder);
}
$files = new \RecursiveIteratorIterator(
new \RecursiveDirectoryIterator($folder, \RecursiveDirectoryIterator::SKIP_DOTS),
\RecursiveIteratorIterator::CHILD_FIRST
);
/** @var \DirectoryIterator $fileinfo */
foreach ($files as $fileinfo) {
if ($fileinfo->isDir()) {
if (false === @rmdir($fileinfo->getRealPath())) {
return false;
}
} else {
if (false === @unlink($fileinfo->getRealPath())) {
return false;
}
}
// Go through all items in filesystem and recursively remove everything.
$files = array_diff(scandir($folder), array('.', '..'));
foreach ($files as $file) {
$path = "{$folder}/{$file}";
(is_dir($path)) ? self::doDelete($path) : @unlink($path);
}
return $include_target ? @rmdir($folder) : true;