mirror of
https://github.com/getgrav/grav.git
synced 2026-05-06 04:57:13 +02:00
Fixed Folder::delete method to recursively remove files and folders and causing Upgrade to fail.
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user