summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-05-02 18:45:09 +0200
committerVincent Petry <pvince81@owncloud.com>2014-05-02 18:45:09 +0200
commit9e18be642239a77014ff16598a50cd413b70af46 (patch)
treec7c747355ff1db1a81bacc97a9d3af0547edeae1 /apps
parent49d9631eee1616b9ae2846886c3d428236c5b81a (diff)
parent49822dfcdb752428b43040a26d97c5e52ecf3458 (diff)
downloadnextcloud-server-9e18be642239a77014ff16598a50cd413b70af46.tar.gz
nextcloud-server-9e18be642239a77014ff16598a50cd413b70af46.zip
Merge pull request #8377 from youngguns-nl/issue_8376
RecursiveDirectoryIterator does not work on NFS
Diffstat (limited to 'apps')
-rw-r--r--apps/files_trashbin/lib/trashbin.php10
1 files changed, 9 insertions, 1 deletions
diff --git a/apps/files_trashbin/lib/trashbin.php b/apps/files_trashbin/lib/trashbin.php
index 9b931333b7f..173eb2164cf 100644
--- a/apps/files_trashbin/lib/trashbin.php
+++ b/apps/files_trashbin/lib/trashbin.php
@@ -883,11 +883,19 @@ class Trashbin {
$iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($root), \RecursiveIteratorIterator::CHILD_FIRST);
$size = 0;
- foreach ($iterator as $path) {
+ /**
+ * RecursiveDirectoryIterator on an NFS path isn't iterable with foreach
+ * This bug is fixed in PHP 5.5.9 or before
+ * See #8376
+ */
+ $iterator->rewind();
+ while ($iterator->valid()) {
+ $path = $iterator->current();
$relpath = substr($path, strlen($root) - 1);
if (!$view->is_dir($relpath)) {
$size += $view->filesize($relpath);
}
+ $iterator->next();
}
return $size;
}