Skip to content
Snippets Groups Projects
Commit c30a68e2 authored by Robin Appelman's avatar Robin Appelman
Browse files

Merge pull request #20060 from owncloud/cache-move-final-update-transaction

include the final update in the transaction when moving a folder in the cache
parents d7efb6d8 01d3393b
Branches
No related tags found
No related merge requests found
...@@ -485,6 +485,9 @@ class Cache { ...@@ -485,6 +485,9 @@ class Cache {
list($sourceStorageId, $sourcePath) = $sourceCache->getMoveInfo($sourcePath); list($sourceStorageId, $sourcePath) = $sourceCache->getMoveInfo($sourcePath);
list($targetStorageId, $targetPath) = $this->getMoveInfo($targetPath); 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') { if ($sourceData['mimetype'] === 'httpd/unix-directory') {
//find all child entries //find all child entries
$sql = 'SELECT `path`, `fileid` FROM `*PREFIX*filecache` WHERE `storage` = ? AND `path` LIKE ?'; $sql = 'SELECT `path`, `fileid` FROM `*PREFIX*filecache` WHERE `storage` = ? AND `path` LIKE ?';
...@@ -498,11 +501,12 @@ class Cache { ...@@ -498,11 +501,12 @@ class Cache {
$newTargetPath = $targetPath . substr($child['path'], $sourceLength); $newTargetPath = $targetPath . substr($child['path'], $sourceLength);
\OC_DB::executeAudited($query, [$targetStorageId, $newTargetPath, md5($newTargetPath), $child['fileid']]); \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(); \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]);
} }
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment