]> source.dussan.org Git - nextcloud-server.git/commitdiff
Update the cache when renaming even if we dont emit hooks
authorRobin Appelman <icewind@owncloud.com>
Mon, 26 Jan 2015 13:34:40 +0000 (14:34 +0100)
committerRobin Appelman <icewind@owncloud.com>
Wed, 28 Jan 2015 12:44:39 +0000 (13:44 +0100)
lib/private/files/node/root.php
lib/private/files/view.php

index 1dd4a3e378d7c1d9c02f477bcd2629c946c20f59..1834ef67befa2ac0d44faafdf474d3705079e62b 100644 (file)
@@ -155,7 +155,7 @@ class Root extends Folder implements IRootFolder {
         * @param string $path
         * @throws \OCP\Files\NotFoundException
         * @throws \OCP\Files\NotPermittedException
-        * @return string
+        * @return \OCP\Files\Node
         */
        public function get($path) {
                $path = $this->normalizePath($path);
index 096d8044b755475435251827a571c4e0d035db39..a2717ce43212f4dd8bef11043799708be9cf424b 100644 (file)
@@ -537,16 +537,18 @@ class View {
                                        if ($this->shouldEmitHooks()) {
                                                $this->emit_file_hooks_post($exists, $path2);
                                        }
-                               } elseif ($this->shouldEmitHooks() && $result !== false) {
+                               } elseif ($result !== false) {
                                        $this->updater->rename($path1, $path2);
-                                       \OC_Hook::emit(
-                                               Filesystem::CLASSNAME,
-                                               Filesystem::signal_post_rename,
-                                               array(
-                                                       Filesystem::signal_param_oldpath => $this->getHookPath($path1),
-                                                       Filesystem::signal_param_newpath => $this->getHookPath($path2)
-                                               )
-                                       );
+                                       if ($this->shouldEmitHooks($path1) and $this->shouldEmitHooks($path2)) {
+                                               \OC_Hook::emit(
+                                                       Filesystem::CLASSNAME,
+                                                       Filesystem::signal_post_rename,
+                                                       array(
+                                                               Filesystem::signal_param_oldpath => $this->getHookPath($path1),
+                                                               Filesystem::signal_param_newpath => $this->getHookPath($path2)
+                                                       )
+                                               );
+                                       }
                                }
                                return $result;
                        } else {
@@ -1315,7 +1317,7 @@ class View {
                $maxLen = min(PHP_MAXPATHLEN, 4000);
                // Check for the string length - performed using isset() instead of strlen()
                // because isset() is about 5x-40x faster.
-               if(isset($path[$maxLen])) {
+               if (isset($path[$maxLen])) {
                        $pathLen = strlen($path);
                        throw new \OCP\Files\InvalidPathException("Path length($pathLen) exceeds max path length($maxLen): $path");
                }
@@ -1351,7 +1353,7 @@ class View {
         * @return \OCP\Files\FileInfo
         */
        private function getPartFileInfo($path) {
-               $mount  = $this->getMount($path);
+               $mount = $this->getMount($path);
                $storage = $mount->getStorage();
                $internalPath = $mount->getInternalPath($this->getAbsolutePath($path));
                return new FileInfo(