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

Cache: more efficient detection for existing entries during upgrade

parent 56ae4bb6
No related branches found
No related tags found
No related merge requests found
......@@ -82,15 +82,9 @@ class Upgrade {
* @return bool
*/
function inCache($storage, $pathHash, $id) {
$query = \OC_DB::prepare('SELECT `fileid` FROM `*PREFIX*filecache` WHERE `storage` = ? AND `path_hash` = ?');
$result = $query->execute(array($storage, $pathHash));
if ($result->fetchRow()) {
return true;
} else {
$query = \OC_DB::prepare('SELECT `fileid` FROM `*PREFIX*filecache` WHERE `fileid` = ?');
$result = $query->execute(array($id));
return (bool)$result->fetchRow();
}
$query = \OC_DB::prepare('SELECT `fileid` FROM `*PREFIX*filecache` WHERE (`storage` = ? AND `path_hash` = ?) OR `fileid` = ?');
$result = $query->execute(array($storage, $pathHash, $id));
return (bool)$result->fetchRow();
}
/**
......
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