]> source.dussan.org Git - nextcloud-server.git/commitdiff
Merge branch 'master' into hook-improvements
authorMichael Gapczynski <mtgap@owncloud.com>
Tue, 4 Jun 2013 22:19:08 +0000 (18:19 -0400)
committerMichael Gapczynski <mtgap@owncloud.com>
Tue, 4 Jun 2013 22:19:08 +0000 (18:19 -0400)
Conflicts:
lib/files/view.php

1  2 
lib/files/view.php

index d2d1a99818bfd92931348f7b2471b1843aac3d22,ecb0f30400a43545a444cc86a402421bb6f619f8..e2fc8d965b892dfdc405f47e227757b8feaea00a
@@@ -295,7 -300,7 +300,7 @@@ class View 
                                        list ($count, $result) = \OC_Helper::streamCopy($data, $target);
                                        fclose($target);
                                        fclose($data);
-                                       if ($this->fakeRoot == Filesystem::getRoot() && ! Cache\Scanner::isIgnoredFile($path) && $result !== false) {
 -                                      if ($this->fakeRoot == Filesystem::getRoot() && !Cache\Scanner::isPartialFile($path)) {
++                                      if ($this->fakeRoot == Filesystem::getRoot() && !Cache\Scanner::isPartialFile($path) && $result !== false) {
                                                if (!$exists) {
                                                        \OC_Hook::emit(
                                                                Filesystem::CLASSNAME,
                                                $result = false;
                                        }
                                } else {
-                                       $source = $this->fopen($path1 . $postFix1, 'r');
-                                       $target = $this->fopen($path2 . $postFix2, 'w');
-                                       list($count, $result) = \OC_Helper::streamCopy($source, $target);
-                                       list($storage1, $internalPath1) = Filesystem::resolvePath($absolutePath1 . $postFix1);
-                                       if ($result !== false) {
-                                               $storage1->unlink($internalPath1);
+                                       if ($this->is_dir($path1)) {
+                                               $result = $this->copy($path1, $path2);
+                                               if ($result === true) {
+                                                       list($storage1, $internalPath1) = Filesystem::resolvePath($absolutePath1 . $postFix1);
+                                                       $result = $storage1->deleteAll($internalPath1);
+                                               }
+                                       } else {
+                                               $source = $this->fopen($path1 . $postFix1, 'r');
+                                               $target = $this->fopen($path2 . $postFix2, 'w');
+                                               list($count, $result) = \OC_Helper::streamCopy($source, $target);
 -                                              list($storage1, $internalPath1) = Filesystem::resolvePath($absolutePath1 . $postFix1);
 -                                              $storage1->unlink($internalPath1);
++                                              if ($result !== false) {
++                                                      list($storage1, $internalPath1) = Filesystem::resolvePath($absolutePath1 . $postFix1);
++                                                      $storage1->unlink($internalPath1);
++                                              }
                                        }
                                }
-                               if ($this->fakeRoot == Filesystem::getRoot() && $result !== false) {
 -                              if ($this->fakeRoot == Filesystem::getRoot() && !Cache\Scanner::isPartialFile($path1)) {
++                              if ($this->fakeRoot == Filesystem::getRoot() && !Cache\Scanner::isPartialFile($path1) && $result !== false) {
                                        \OC_Hook::emit(
                                                Filesystem::CLASSNAME,
                                                Filesystem::signal_post_rename,
                                                $result = false;
                                        }
                                } else {
-                                       $source = $this->fopen($path1 . $postFix1, 'r');
-                                       $target = $this->fopen($path2 . $postFix2, 'w');
-                                       list($count, $result) = \OC_Helper::streamCopy($source, $target);
+                                       if ($this->is_dir($path1) && ($dh = $this->opendir($path1))) {
+                                               $result = $this->mkdir($path2);
+                                               while ($file = readdir($dh)) {
+                                                       if (!Filesystem::isIgnoredDir($file)) {
+                                                               $result = $this->copy($path1 . '/' . $file, $path2 . '/' . $file);
+                                                       }
+                                               }
+                                       } else {
+                                               $source = $this->fopen($path1 . $postFix1, 'r');
+                                               $target = $this->fopen($path2 . $postFix2, 'w');
+                                               list($count, $result) = \OC_Helper::streamCopy($source, $target);
+                                       }
                                }
 -                              if ($this->fakeRoot == Filesystem::getRoot()) {
 +                              if ($this->fakeRoot == Filesystem::getRoot() && $result !== false) {
                                        \OC_Hook::emit(
                                                Filesystem::CLASSNAME,
                                                Filesystem::signal_post_copy,