diff options
author | Robin Appelman <icewind@owncloud.com> | 2015-04-01 15:15:24 +0200 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2015-04-13 17:10:01 +0200 |
commit | caadc8cdd9044236388dfb557ba21a5de7f147fc (patch) | |
tree | 6e14f763b64e0fab954391ce24ef3929b7fbd3ba /lib/private/files/cache | |
parent | d7b3a1a35a47dd37f68f7819aa0789b794e352e5 (diff) | |
download | nextcloud-server-caadc8cdd9044236388dfb557ba21a5de7f147fc.tar.gz nextcloud-server-caadc8cdd9044236388dfb557ba21a5de7f147fc.zip |
reuse cache move logic
Diffstat (limited to 'lib/private/files/cache')
-rw-r--r-- | lib/private/files/cache/cache.php | 27 |
1 files changed, 1 insertions, 26 deletions
diff --git a/lib/private/files/cache/cache.php b/lib/private/files/cache/cache.php index fd4c5715a67..ee9da231090 100644 --- a/lib/private/files/cache/cache.php +++ b/lib/private/files/cache/cache.php @@ -435,32 +435,7 @@ class Cache { * @param string $target */ public function move($source, $target) { - // normalize source and target - $source = $this->normalize($source); - $target = $this->normalize($target); - - $sourceData = $this->get($source); - $sourceId = $sourceData['fileid']; - $newParentId = $this->getParentId($target); - - if ($sourceData['mimetype'] === 'httpd/unix-directory') { - //find all child entries - $sql = 'SELECT `path`, `fileid` FROM `*PREFIX*filecache` WHERE `storage` = ? AND `path` LIKE ?'; - $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` = ?'; - \OC_DB::executeAudited($sql, array($target, md5($target), basename($target), $newParentId, $sourceId)); + $this->moveFromCache($this, $source, $target); } /** |