diff options
Diffstat (limited to 'lib/files/storage/common.php')
-rw-r--r-- | lib/files/storage/common.php | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/lib/files/storage/common.php b/lib/files/storage/common.php index 01560f34fde..a5b79f0e967 100644 --- a/lib/files/storage/common.php +++ b/lib/files/storage/common.php @@ -142,13 +142,15 @@ abstract class Common implements \OC\Files\Storage\Storage { return false; } else { $directoryHandle = $this->opendir($directory); - while (($contents = readdir($directoryHandle)) !== false) { - if (!\OC\Files\Filesystem::isIgnoredDir($contents)) { - $path = $directory . '/' . $contents; - if ($this->is_dir($path)) { - $this->deleteAll($path); - } else { - $this->unlink($path); + if(is_resource($directoryHandle)) { + while (($contents = readdir($directoryHandle)) !== false) { + if (!\OC\Files\Filesystem::isIgnoredDir($contents)) { + $path = $directory . '/' . $contents; + if ($this->is_dir($path)) { + $this->deleteAll($path); + } else { + $this->unlink($path); + } } } } @@ -224,7 +226,8 @@ abstract class Common implements \OC\Files\Storage\Storage { } private function addLocalFolder($path, $target) { - if ($dh = $this->opendir($path)) { + $dh = $this->opendir($path); + if(is_resource($dh)) { while (($file = readdir($dh)) !== false) { if ($file !== '.' and $file !== '..') { if ($this->is_dir($path . '/' . $file)) { @@ -242,7 +245,7 @@ abstract class Common implements \OC\Files\Storage\Storage { protected function searchInDir($query, $dir = '') { $files = array(); $dh = $this->opendir($dir); - if ($dh) { + if (is_resource($dh)) { while (($item = readdir($dh)) !== false) { if ($item == '.' || $item == '..') continue; if (strstr(strtolower($item), strtolower($query)) !== false) { |