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

update file paths in filecache when the parent is renamed

parent 4bc88ef5
No related branches found
No related tags found
No related merge requests found
...@@ -169,6 +169,15 @@ class OC_FileCache{ ...@@ -169,6 +169,15 @@ class OC_FileCache{
$newParent=self::getParentId($newPath); $newParent=self::getParentId($newPath);
$query=OC_DB::prepare('UPDATE *PREFIX*fscache SET parent=? ,name=?, path=?, path_hash=? WHERE path_hash=?'); $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->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)));
}
} }
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment