summaryrefslogtreecommitdiffstats
path: root/lib/filecache.php
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2012-06-04 17:59:21 +0200
committerRobin Appelman <icewind@owncloud.com>2012-06-04 17:59:42 +0200
commit59086fe08224d772af3a13d8c2f83990acd77ce6 (patch)
treeeb989b9e4ee8cedf37d7caf61dd5bbddd6f812a4 /lib/filecache.php
parentf291a843bf1258a71943aca824c281540c636c1c (diff)
downloadnextcloud-server-59086fe08224d772af3a13d8c2f83990acd77ce6.tar.gz
nextcloud-server-59086fe08224d772af3a13d8c2f83990acd77ce6.zip
update file paths in filecache when the parent is renamed
Diffstat (limited to 'lib/filecache.php')
-rw-r--r--lib/filecache.php9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/filecache.php b/lib/filecache.php
index a29e29928a8..3fb8e4113cb 100644
--- a/lib/filecache.php
+++ b/lib/filecache.php
@@ -169,6 +169,15 @@ class OC_FileCache{
$newParent=self::getParentId($newPath);
$query=OC_DB::prepare('UPDATE *PREFIX*fscache SET parent=? ,name=?, path=?, path_hash=? WHERE path_hash=?');
$query->execute(array($newParent,basename($newPath),$newPath,md5($newPath),md5($oldPath)));
+
+ $query=OC_DB::prepare('SELECT path FROM *PREFIX*fscache WHERE path LIKE ?');
+ $oldLength=strlen($oldPath);
+ $updateQuery=OC_DB::prepare('UPDATE *PREFIX*fscache SET path=?, path_hash=? WHERE path_hash=?');
+ while($row= $query->execute(array($oldPath.'/%'))->fetchRow()){
+ $old=$row['path'];
+ $new=$newPath.substr($old,$oldLength);
+ $updateQuery->execute(array($new,md5($new),md5($old)));
+ }
}
/**