Cache: more efficient detection for existing entries during upgrade

This commit is contained in:
Robin Appelman 2013-03-04 23:19:55 +01:00
parent 56ae4bb6e9
commit 9d9acf24de
1 changed files with 3 additions and 9 deletions

View File

@ -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();
}
/**