diff options
author | Robin Appelman <icewind@owncloud.com> | 2013-05-21 23:35:19 +0200 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2013-05-21 23:35:19 +0200 |
commit | 81fd1badc3feb72c3a4e597c670e8adcdca525da (patch) | |
tree | dda3deee50551ebdffa8a9021b528ac29fdbf369 /lib/files/view.php | |
parent | d7beac6d6f3ad588cee6c5ba8a2145b42fa184a2 (diff) | |
parent | fb4d8ddf0a76da7e9f806b837f9cf23699671f75 (diff) | |
download | nextcloud-server-81fd1badc3feb72c3a4e597c670e8adcdca525da.tar.gz nextcloud-server-81fd1badc3feb72c3a4e597c670e8adcdca525da.zip |
merge master into filecache_mtime
Diffstat (limited to 'lib/files/view.php')
-rw-r--r-- | lib/files/view.php | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/lib/files/view.php b/lib/files/view.php index 3cea8b082dc..bc6b80c505a 100644 --- a/lib/files/view.php +++ b/lib/files/view.php @@ -245,7 +245,9 @@ class View { if (!is_null($mtime) and !is_numeric($mtime)) { $mtime = strtotime($mtime); } + $hooks = array('touch'); + if (!$this->file_exists($path)) { $hooks[] = 'write'; } @@ -264,11 +266,13 @@ class View { if (is_resource($data)) { //not having to deal with streams in file_put_contents makes life easier $absolutePath = Filesystem::normalizePath($this->getAbsolutePath($path)); if (\OC_FileProxy::runPreProxies('file_put_contents', $absolutePath, $data) - && Filesystem::isValidPath($path)) { + and Filesystem::isValidPath($path) + and ! Filesystem::isFileBlacklisted($path) + ) { $path = $this->getRelativePath($absolutePath); $exists = $this->file_exists($path); $run = true; - if ($this->fakeRoot == Filesystem::getRoot()) { + if ($this->fakeRoot == Filesystem::getRoot() && !Cache\Scanner::isPartialFile($path)) { if (!$exists) { \OC_Hook::emit( Filesystem::CLASSNAME, @@ -296,7 +300,7 @@ class View { list ($count, $result) = \OC_Helper::streamCopy($data, $target); fclose($target); fclose($data); - if ($this->fakeRoot == Filesystem::getRoot()) { + if ($this->fakeRoot == Filesystem::getRoot() && !Cache\Scanner::isPartialFile($path)) { if (!$exists) { \OC_Hook::emit( Filesystem::CLASSNAME, @@ -336,8 +340,12 @@ class View { $postFix2 = (substr($path2, -1, 1) === '/') ? '/' : ''; $absolutePath1 = Filesystem::normalizePath($this->getAbsolutePath($path1)); $absolutePath2 = Filesystem::normalizePath($this->getAbsolutePath($path2)); - if (\OC_FileProxy::runPreProxies('rename', $absolutePath1, $absolutePath2) - and Filesystem::isValidPath($path2)) { + if ( + \OC_FileProxy::runPreProxies('rename', $absolutePath1, $absolutePath2) + and Filesystem::isValidPath($path2) + and Filesystem::isValidPath($path1) + and ! Filesystem::isFileBlacklisted($path2) + ) { $path1 = $this->getRelativePath($absolutePath1); $path2 = $this->getRelativePath($absolutePath2); @@ -345,7 +353,7 @@ class View { return false; } $run = true; - if ($this->fakeRoot == Filesystem::getRoot()) { + if ($this->fakeRoot == Filesystem::getRoot() && !Cache\Scanner::isPartialFile($path1)) { \OC_Hook::emit( Filesystem::CLASSNAME, Filesystem::signal_rename, array( @@ -373,7 +381,7 @@ class View { list($storage1, $internalPath1) = Filesystem::resolvePath($absolutePath1 . $postFix1); $storage1->unlink($internalPath1); } - if ($this->fakeRoot == Filesystem::getRoot()) { + if ($this->fakeRoot == Filesystem::getRoot() && !Cache\Scanner::isPartialFile($path1)) { \OC_Hook::emit( Filesystem::CLASSNAME, Filesystem::signal_post_rename, @@ -397,7 +405,12 @@ class View { $postFix2 = (substr($path2, -1, 1) === '/') ? '/' : ''; $absolutePath1 = Filesystem::normalizePath($this->getAbsolutePath($path1)); $absolutePath2 = Filesystem::normalizePath($this->getAbsolutePath($path2)); - if (\OC_FileProxy::runPreProxies('copy', $absolutePath1, $absolutePath2) and Filesystem::isValidPath($path2)) { + if ( + \OC_FileProxy::runPreProxies('copy', $absolutePath1, $absolutePath2) + and Filesystem::isValidPath($path2) + and Filesystem::isValidPath($path1) + and ! Filesystem::isFileBlacklisted($path2) + ) { $path1 = $this->getRelativePath($absolutePath1); $path2 = $this->getRelativePath($absolutePath2); @@ -599,7 +612,10 @@ class View { private function basicOperation($operation, $path, $hooks = array(), $extraParam = null) { $postFix = (substr($path, -1, 1) === '/') ? '/' : ''; $absolutePath = Filesystem::normalizePath($this->getAbsolutePath($path)); - if (\OC_FileProxy::runPreProxies($operation, $absolutePath, $extraParam) and Filesystem::isValidPath($path)) { + if (\OC_FileProxy::runPreProxies($operation, $absolutePath, $extraParam) + and Filesystem::isValidPath($path) + and ! Filesystem::isFileBlacklisted($path) + ) { $path = $this->getRelativePath($absolutePath); if ($path == null) { return false; @@ -732,6 +748,7 @@ class View { * get the content of a directory * * @param string $directory path under datadirectory + * @param string $mimetype_filter limit returned content to this mimetype or mimepart * @return array */ public function getDirectoryContent($directory, $mimetype_filter = '') { @@ -969,7 +986,7 @@ class View { */ public function getPath($id) { list($storage, $internalPath) = Cache\Cache::getById($id); - $mounts = Mount::findByStorageId($storage); + $mounts = Filesystem::getMountByStorageId($storage); foreach ($mounts as $mount) { /** * @var \OC\Files\Mount $mount |