]> source.dussan.org Git - nextcloud-server.git/commitdiff
Reenable trashbin after failed rename
authorVincent Petry <pvince81@owncloud.com>
Wed, 18 Mar 2015 18:22:15 +0000 (19:22 +0100)
committerVincent Petry <pvince81@owncloud.com>
Wed, 18 Mar 2015 18:56:31 +0000 (19:56 +0100)
After a failed rename, the post_rename hook is not called.
This quickfix makes sure the trashbin storage logic is reenabled
also after a failed rename.

apps/files_trashbin/lib/storage.php

index 175889ef95d621fa0a18aee4fdd79722202221f4..d15b136924cbece2805a4518f1f1546c02e7ccac 100644 (file)
@@ -61,6 +61,22 @@ class Storage extends Wrapper {
                self::$disableTrash = false;
        }
 
+       /**
+        * Rename path1 to path2 by calling the wrapped storage.
+        *
+        * @param string $path1 first path
+        * @param string $path2 second path
+        */
+       public function rename($path1, $path2) {
+               $result = $this->storage->rename($path1, $path2);
+               if ($result === false) {
+                       // when rename failed, the post_rename hook isn't triggered,
+                       // but we still want to reenable the trash logic
+                       self::$disableTrash = false;
+               }
+               return $result;
+       }
+
        /**
         * Deletes the given file by moving it into the trashbin.
         *