From 6c00521e8b053272f1314c0727f0278ffde90ffe Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Fri, 6 Feb 2015 15:20:53 +0100 Subject: [PATCH] Use transactions when renaming directory contents --- lib/private/files/cache/cache.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/private/files/cache/cache.php b/lib/private/files/cache/cache.php index 5438bdad5cb..cad4c8a40b9 100644 --- a/lib/private/files/cache/cache.php +++ b/lib/private/files/cache/cache.php @@ -408,12 +408,14 @@ class Cache { $result = \OC_DB::executeAudited($sql, array($this->getNumericStorageId(), $source . '/%')); $childEntries = $result->fetchAll(); $sourceLength = strlen($source); + \OC_DB::beginTransaction(); $query = \OC_DB::prepare('UPDATE `*PREFIX*filecache` SET `path` = ?, `path_hash` = ? WHERE `fileid` = ?'); foreach ($childEntries as $child) { $targetPath = $target . substr($child['path'], $sourceLength); \OC_DB::executeAudited($query, array($targetPath, md5($targetPath), $child['fileid'])); } + \OC_DB::commit(); } $sql = 'UPDATE `*PREFIX*filecache` SET `path` = ?, `path_hash` = ?, `name` = ?, `parent` =? WHERE `fileid` = ?'; -- 2.39.5