]> source.dussan.org Git - nextcloud-server.git/commitdiff
if a part file gets renamed to a real file, that this was the second step of a write...
authorBjörn Schießle <schiessle@owncloud.com>
Mon, 1 Jul 2013 14:21:31 +0000 (16:21 +0200)
committerBjörn Schießle <schiessle@owncloud.com>
Wed, 3 Jul 2013 08:11:37 +0000 (10:11 +0200)
lib/files/view.php

index d8d996980231ec012aade1391f388fb9e6af62a0..f62b84d27aa1c5cfab4f6a72e2c0ad8d020f2dea 100644 (file)
@@ -353,7 +353,16 @@ class View {
                                return false;
                        }
                        $run = true;
-                       if ($this->fakeRoot == Filesystem::getRoot() && !Cache\Scanner::isPartialFile($path1)) {
+                       if ($this->fakeRoot == Filesystem::getRoot() && (Cache\Scanner::isPartialFile($path1) && !Cache\Scanner::isPartialFile($path2))) {
+                               // if it was a rename from a part file to a regular file it was a write and not a rename operation
+                               \OC_Hook::emit(
+                                       Filesystem::CLASSNAME, Filesystem::signal_write,
+                                       array(
+                                               Filesystem::signal_param_path => $path2,
+                                               Filesystem::signal_param_run => &$run
+                                       )
+                               );
+                       } elseif ($this->fakeRoot == Filesystem::getRoot()) {
                                \OC_Hook::emit(
                                        Filesystem::CLASSNAME, Filesystem::signal_rename,
                                        array(
@@ -398,7 +407,16 @@ class View {
                                                }
                                        }
                                }
-                               if ($this->fakeRoot == Filesystem::getRoot() && !Cache\Scanner::isPartialFile($path1) && $result !== false) {
+                               if ($this->fakeRoot == Filesystem::getRoot() && (Cache\Scanner::isPartialFile($path1) && !Cache\Scanner::isPartialFile($path2)) && $result !== false) {
+                                       // if it was a rename from a part file to a regular file it was a write and not a rename operation
+                                       \OC_Hook::emit(
+                                               Filesystem::CLASSNAME,
+                                               Filesystem::signal_post_write,
+                                               array(
+                                                       Filesystem::signal_param_path => $path2,
+                                               )
+                                       );
+                               } elseif ($this->fakeRoot == Filesystem::getRoot() && $result !== false) {
                                        \OC_Hook::emit(
                                                Filesystem::CLASSNAME,
                                                Filesystem::signal_post_rename,