[Pkg-owncloud-commits] [owncloud] 47/258: Keep fileid on move in objectstore, fixes #10848

David Prévot taffit at moszumanska.debian.org
Sat Oct 11 17:22:19 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository owncloud.

commit c52f66cc73486f11b6b829e8b09c72bb96575ad9
Author: Jörn Friedrich Dreyer <jfd at butonic.de>
Date:   Fri Sep 5 13:25:59 2014 +0200

    Keep fileid on move in objectstore, fixes #10848
---
 .../files/objectstore/objectstorestorage.php       | 38 +++-------------------
 1 file changed, 5 insertions(+), 33 deletions(-)

diff --git a/lib/private/files/objectstore/objectstorestorage.php b/lib/private/files/objectstore/objectstorestorage.php
index 0292d77..241864b 100644
--- a/lib/private/files/objectstore/objectstorestorage.php
+++ b/lib/private/files/objectstore/objectstorestorage.php
@@ -82,7 +82,7 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common {
 			$parentExists = true;
 
 			// we are done when the root folder was meant to be created
-			if  ($dirName === $path) {
+			if ($dirName === $path) {
 				return true;
 			}
 		}
@@ -290,38 +290,10 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common {
 	public function rename($source, $target) {
 		$source = $this->normalizePath($source);
 		$target = $this->normalizePath($target);
-		$stat1 = $this->stat($source);
-		if (isset($stat1['mimetype']) && $stat1['mimetype'] === 'httpd/unix-directory') {
-			$this->remove($target);
-			$dir = $this->opendir($source);
-			$this->mkdir($target);
-			while ($file = readdir($dir)) {
-				if (!Filesystem::isIgnoredDir($file)) {
-					if (!$this->rename($source . '/' . $file, $target . '/' . $file)) {
-						return false;
-					}
-				}
-			}
-			closedir($dir);
-			$this->remove($source);
-			return true;
-		} else {
-			if (is_array($stat1)) {
-				$parent = $this->stat(dirname($target));
-				if (is_array($parent)) {
-					$this->remove($target);
-					$stat1['parent'] = $parent['fileid'];
-					$stat1['path'] = $target;
-					$stat1['path_hash'] = md5($target);
-					$stat1['name'] = \OC_Util::basename($target);
-					$stat1['mtime'] = time();
-					$stat1['etag'] = $this->getETag($target);
-					$this->getCache()->update($stat1['fileid'], $stat1);
-					return true;
-				}
-			}
-		}
-		return false;
+		$this->remove($target);
+		$this->getCache()->move($source, $target);
+		$this->touch(dirname($target));
+		return true;
 	}
 
 	public function getMimeType($path) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list