refs #8376; added comment and applied patch on other files

remotes/origin/ldap_group_count
Sjors van der Pluijm 10 years ago
parent d7ec1fe447
commit 54f482ff9c

@ -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;
}

@ -44,6 +44,11 @@ if (\OC_Util::runningOnWindows()) {
new \RecursiveDirectoryIterator($this->datadir . $path),
\RecursiveIteratorIterator::CHILD_FIRST
);
/**
* RecursiveDirectoryIterator on an NFS path isn't iterable with foreach
* This bug is fixed in PHP 5.5.9 or before
* See #8376
*/
$it->rewind();
while ($it->valid()) {
/**

@ -39,17 +39,26 @@ class MappedLocal extends \OC\Files\Storage\Common{
new \RecursiveDirectoryIterator($this->buildPath($path)),
\RecursiveIteratorIterator::CHILD_FIRST
);
foreach ($it as $file) {
/**
* RecursiveDirectoryIterator on an NFS path isn't iterable with foreach
* This bug is fixed in PHP 5.5.9 or before
* See #8376
*/
$it->rewind();
while ($it->valid()) {
/**
* @var \SplFileInfo $file
*/
$file = $it->current();
if (in_array($file->getBasename(), array('.', '..'))) {
$it->next();
continue;
} elseif ($file->isDir()) {
rmdir($file->getPathname());
} elseif ($file->isFile() || $file->isLink()) {
unlink($file->getPathname());
}
$it->next();
}
if ($result = @rmdir($this->buildPath($path))) {
$this->cleanMapper($path);

Loading…
Cancel
Save