]> source.dussan.org Git - nextcloud-server.git/commitdiff
Use transactions when renaming directory contents
authorRobin Appelman <icewind@owncloud.com>
Fri, 6 Feb 2015 14:20:53 +0000 (15:20 +0100)
committerRobin Appelman <icewind@owncloud.com>
Fri, 6 Feb 2015 14:20:53 +0000 (15:20 +0100)
lib/private/files/cache/cache.php

index 5438bdad5cbfc61e6f9f1b64ce3c8beaed6d20bd..cad4c8a40b98c346911e1a602bdb02121ad4245a 100644 (file)
@@ -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` = ?';