summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMichael Gapczynski <mtgap@owncloud.com>2013-05-07 07:52:57 -0700
committerMichael Gapczynski <mtgap@owncloud.com>2013-05-07 07:52:57 -0700
commit349a533f667bdac2325a797dcee6007117063039 (patch)
tree479f050e43f9758b004694b56db94234a3f1e841 /lib
parent398fbb61f8d4f579da3891c4516d5fb71759246a (diff)
parent10be42f5b7b17ca55c242960885a9b50e217af3f (diff)
downloadnextcloud-server-349a533f667bdac2325a797dcee6007117063039.tar.gz
nextcloud-server-349a533f667bdac2325a797dcee6007117063039.zip
Merge pull request #3025 from owncloud/move-file
Cache: only look for child entires when doing a move operation when moving a folder
Diffstat (limited to 'lib')
-rw-r--r--lib/files/cache/cache.php25
1 files changed, 14 insertions, 11 deletions
diff --git a/lib/files/cache/cache.php b/lib/files/cache/cache.php
index 47f3c272b13..8f5c9643bef 100644
--- a/lib/files/cache/cache.php
+++ b/lib/files/cache/cache.php
@@ -318,19 +318,22 @@ class Cache {
* @param string $target
*/
public function move($source, $target) {
- $sourceId = $this->getId($source);
+ $sourceData = $this->get($source);
+ $sourceId = $sourceData['fileid'];
$newParentId = $this->getParentId($target);
- //find all child entries
- $query = \OC_DB::prepare('SELECT `path`, `fileid` FROM `*PREFIX*filecache` WHERE `path` LIKE ?');
- $result = $query->execute(array($source . '/%'));
- $childEntries = $result->fetchAll();
- $sourceLength = strlen($source);
- $query = \OC_DB::prepare('UPDATE `*PREFIX*filecache` SET `path` = ?, `path_hash` = ? WHERE `fileid` = ?');
-
- foreach ($childEntries as $child) {
- $targetPath = $target . substr($child['path'], $sourceLength);
- $query->execute(array($targetPath, md5($targetPath), $child['fileid']));
+ if ($sourceData['mimetype'] === 'httpd/unix-directory') {
+ //find all child entries
+ $query = \OC_DB::prepare('SELECT `path`, `fileid` FROM `*PREFIX*filecache` WHERE `path` LIKE ?');
+ $result = $query->execute(array($source . '/%'));
+ $childEntries = $result->fetchAll();
+ $sourceLength = strlen($source);
+ $query = \OC_DB::prepare('UPDATE `*PREFIX*filecache` SET `path` = ?, `path_hash` = ? WHERE `fileid` = ?');
+
+ foreach ($childEntries as $child) {
+ $targetPath = $target . substr($child['path'], $sourceLength);
+ $query->execute(array($targetPath, md5($targetPath), $child['fileid']));
+ }
}
$query = \OC_DB::prepare('UPDATE `*PREFIX*filecache` SET `path` = ?, `path_hash` = ?, `name` = ?, `parent` =?'