[Pkg-owncloud-commits] [owncloud] 01/69: include the final update in the transaction when moving a folder in the cache

David Prévot taffit at moszumanska.debian.org
Wed Nov 11 02:03:57 UTC 2015


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

taffit pushed a commit to branch stable8
in repository owncloud.

commit fe0e567bbc3c15d5eff3408742518a9cfb0f51fd
Author: Robin Appelman <icewind at owncloud.com>
Date:   Mon Oct 26 16:31:26 2015 +0100

    include the final update in the transaction when moving a folder in the cache
---
 lib/private/files/cache/cache.php | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/private/files/cache/cache.php b/lib/private/files/cache/cache.php
index f3e2270..e4e3522 100644
--- a/lib/private/files/cache/cache.php
+++ b/lib/private/files/cache/cache.php
@@ -477,6 +477,9 @@ class Cache {
 		list($sourceStorageId, $sourcePath) = $sourceCache->getMoveInfo($sourcePath);
 		list($targetStorageId, $targetPath) = $this->getMoveInfo($targetPath);
 
+		// sql for final update
+		$moveSql = 'UPDATE `*PREFIX*filecache` SET `storage` =  ?, `path` = ?, `path_hash` = ?, `name` = ?, `parent` =? WHERE `fileid` = ?';
+
 		if ($sourceData['mimetype'] === 'httpd/unix-directory') {
 			//find all child entries
 			$sql = 'SELECT `path`, `fileid` FROM `*PREFIX*filecache` WHERE `storage` = ? AND `path` LIKE ?';
@@ -490,11 +493,12 @@ class Cache {
 				$newTargetPath = $targetPath . substr($child['path'], $sourceLength);
 				\OC_DB::executeAudited($query, [$targetStorageId, $newTargetPath, md5($newTargetPath), $child['fileid']]);
 			}
+			\OC_DB::executeAudited($moveSql, [$targetStorageId, $targetPath, md5($targetPath), basename($targetPath), $newParentId, $sourceId]);
 			\OC_DB::commit();
+		} else {
+			\OC_DB::executeAudited($moveSql, [$targetStorageId, $targetPath, md5($targetPath), basename($targetPath), $newParentId, $sourceId]);
 		}
 
-		$sql = 'UPDATE `*PREFIX*filecache` SET `storage` =  ?, `path` = ?, `path_hash` = ?, `name` = ?, `parent` =? WHERE `fileid` = ?';
-		\OC_DB::executeAudited($sql, [$targetStorageId, $targetPath, md5($targetPath), basename($targetPath), $newParentId, $sourceId]);
 	}
 
 	/**

-- 
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