diff options
Diffstat (limited to 'lib/files/storage')
-rw-r--r-- | lib/files/storage/common.php | 21 | ||||
-rw-r--r-- | lib/files/storage/mappedlocal.php | 18 | ||||
-rw-r--r-- | lib/files/storage/storage.php | 2 |
3 files changed, 23 insertions, 18 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) { diff --git a/lib/files/storage/mappedlocal.php b/lib/files/storage/mappedlocal.php index fbf1b4ebf96..ba5ac4191c5 100644 --- a/lib/files/storage/mappedlocal.php +++ b/lib/files/storage/mappedlocal.php @@ -65,16 +65,18 @@ class MappedLocal extends \OC\Files\Storage\Common{ $logicalPath = $this->mapper->physicalToLogic($physicalPath); $dh = opendir($physicalPath); - while (($file = readdir($dh)) !== false) { - if ($file === '.' or $file === '..') { - continue; - } + if(is_resource($dh)) { + while (($file = readdir($dh)) !== false) { + if ($file === '.' or $file === '..') { + continue; + } - $logicalFilePath = $this->mapper->physicalToLogic($physicalPath.'/'.$file); + $logicalFilePath = $this->mapper->physicalToLogic($physicalPath.'/'.$file); - $file= $this->mapper->stripRootFolder($logicalFilePath, $logicalPath); - $file = $this->stripLeading($file); - $files[]= $file; + $file= $this->mapper->stripRootFolder($logicalFilePath, $logicalPath); + $file = $this->stripLeading($file); + $files[]= $file; + } } \OC\Files\Stream\Dir::register('local-win32'.$path, $files); diff --git a/lib/files/storage/storage.php b/lib/files/storage/storage.php index c96caebf4af..b673bb9a32d 100644 --- a/lib/files/storage/storage.php +++ b/lib/files/storage/storage.php @@ -13,7 +13,7 @@ namespace OC\Files\Storage; * * All paths passed to the storage are relative to the storage and should NOT have a leading slash. */ -interface Storage { +interface Storage extends \OCP\Files\Storage { /** * $parameters is a free form array with the configuration options needed to construct the storage * |