summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Reschke <lukas@owncloud.com>2015-02-08 19:08:52 +0100
committerLukas Reschke <lukas@owncloud.com>2015-02-08 19:08:52 +0100
commit0e604aa875a677f76b2bf326631646ac31fbadbd (patch)
tree7b86ded2c68f7d5ea689313420f39fb7d9cfd125
parentf167c3d9f6105c6baaa9bcb530ee6f32f7b96e4b (diff)
parent6c00521e8b053272f1314c0727f0278ffde90ffe (diff)
downloadnextcloud-server-0e604aa875a677f76b2bf326631646ac31fbadbd.tar.gz
nextcloud-server-0e604aa875a677f76b2bf326631646ac31fbadbd.zip
Merge pull request #13948 from owncloud/cache-move-transaction
Use transactions when renaming directory contents
-rw-r--r--lib/private/files/cache/cache.php2
1 files changed, 2 insertions, 0 deletions
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` = ?';