diff options
Diffstat (limited to 'lib/private/files/storage')
-rw-r--r-- | lib/private/files/storage/common.php | 1 | ||||
-rw-r--r-- | lib/private/files/storage/dav.php | 1 | ||||
-rw-r--r-- | lib/private/files/storage/home.php | 10 | ||||
-rw-r--r-- | lib/private/files/storage/local.php | 17 | ||||
-rw-r--r-- | lib/private/files/storage/mappedlocal.php | 29 |
5 files changed, 21 insertions, 37 deletions
diff --git a/lib/private/files/storage/common.php b/lib/private/files/storage/common.php index 9657b511f15..0720b8180c9 100644 --- a/lib/private/files/storage/common.php +++ b/lib/private/files/storage/common.php @@ -226,6 +226,7 @@ abstract class Common implements \OC\Files\Storage\Storage { $tmpFile = \OC_Helper::tmpFile($extension); $target = fopen($tmpFile, 'w'); \OC_Helper::streamCopy($source, $target); + fclose($target); return $tmpFile; } diff --git a/lib/private/files/storage/dav.php b/lib/private/files/storage/dav.php index 02c3ebd0202..ce447417d20 100644 --- a/lib/private/files/storage/dav.php +++ b/lib/private/files/storage/dav.php @@ -295,6 +295,7 @@ class DAV extends \OC\Files\Storage\Common { \OCP\Util::writeLog("webdav client", 'curl GET ' . curl_getinfo($curl, CURLINFO_EFFECTIVE_URL) . ' returned status code ' . $statusCode, \OCP\Util::ERROR); } curl_close($curl); + fclose($source); $this->removeCachedFile($target); } diff --git a/lib/private/files/storage/home.php b/lib/private/files/storage/home.php index 015b1f01885..85b06f8a510 100644 --- a/lib/private/files/storage/home.php +++ b/lib/private/files/storage/home.php @@ -66,4 +66,14 @@ class Home extends Local implements \OCP\Files\IHomeStorage { public function getUser() { return $this->user; } + + /** + * get the owner of a path + * + * @param string $path The path to get the owner + * @return string uid or false + */ + public function getOwner($path) { + return $this->user->getUID(); + } } diff --git a/lib/private/files/storage/local.php b/lib/private/files/storage/local.php index 63570d70cff..a8b420e978a 100644 --- a/lib/private/files/storage/local.php +++ b/lib/private/files/storage/local.php @@ -208,22 +208,7 @@ if (\OC_Util::runningOnWindows()) { } public function fopen($path, $mode) { - if ($return = fopen($this->datadir . $path, $mode)) { - switch ($mode) { - case 'r': - break; - case 'r+': - case 'w+': - case 'x+': - case 'a+': - break; - case 'w': - case 'x': - case 'a': - break; - } - } - return $return; + return fopen($this->datadir . $path, $mode); } public function hash($type, $path, $raw = false) { diff --git a/lib/private/files/storage/mappedlocal.php b/lib/private/files/storage/mappedlocal.php index c4a8dc1961c..0760d842eaf 100644 --- a/lib/private/files/storage/mappedlocal.php +++ b/lib/private/files/storage/mappedlocal.php @@ -79,7 +79,7 @@ class MappedLocal extends \OC\Files\Storage\Common { $logicalPath = $this->mapper->physicalToLogic($physicalPath); $dh = opendir($physicalPath); - if(is_resource($dh)) { + if (is_resource($dh)) { while (($file = readdir($dh)) !== false) { if ($file === '.' or $file === '..') { continue; @@ -87,9 +87,9 @@ class MappedLocal extends \OC\Files\Storage\Common { $logicalFilePath = $this->mapper->physicalToLogic($physicalPath . '/' . $file); - $file= $this->mapper->stripRootFolder($logicalFilePath, $logicalPath); + $file = $this->mapper->stripRootFolder($logicalFilePath, $logicalPath); $file = $this->stripLeading($file); - $files[]= $file; + $files[] = $file; } } @@ -245,28 +245,15 @@ class MappedLocal extends \OC\Files\Storage\Common { } public function fopen($path, $mode) { - if ($return = fopen($this->buildPath($path), $mode)) { - switch ($mode) { - case 'r': - break; - case 'r+': - case 'w+': - case 'x+': - case 'a+': - break; - case 'w': - case 'x': - case 'a': - break; - } - } - return $return; + return fopen($this->buildPath($path), $mode); } /** * @param string $dir + * @param bool $isLogicPath + * @return bool */ - private function delTree($dir, $isLogicPath=true) { + private function delTree($dir, $isLogicPath = true) { $dirRelative = $dir; if ($isLogicPath) { $dir = $this->buildPath($dir); @@ -380,7 +367,7 @@ class MappedLocal extends \OC\Files\Storage\Common { /** * @param string $path */ - private function cleanMapper($path, $isLogicPath = true, $recursive=true) { + private function cleanMapper($path, $isLogicPath = true, $recursive = true) { $fullPath = $path; if ($isLogicPath) { $fullPath = $this->datadir . $path; |