diff options
author | Michael Gapczynski <mtgap@owncloud.com> | 2013-03-04 14:55:20 -0800 |
---|---|---|
committer | Michael Gapczynski <mtgap@owncloud.com> | 2013-03-04 14:55:20 -0800 |
commit | db23c885d98e65d194d5561339c702f68810d1ab (patch) | |
tree | b23da072987061c811a341d7b40ea089b6c1d0e8 | |
parent | 76e6369ec162f85f41a25212ca83bd95c44c9a9d (diff) | |
parent | 9d9acf24de482bdd5d0b700ba75631b246e5699b (diff) | |
download | nextcloud-server-db23c885d98e65d194d5561339c702f68810d1ab.tar.gz nextcloud-server-db23c885d98e65d194d5561339c702f68810d1ab.zip |
Merge pull request #2096 from owncloud/cache-upgrade-id
Cache: also check if the file id is already in the cache during upgrade
-rw-r--r-- | lib/files/cache/upgrade.php | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/files/cache/upgrade.php b/lib/files/cache/upgrade.php index 1fe4c584686..811d82d7437 100644 --- a/lib/files/cache/upgrade.php +++ b/lib/files/cache/upgrade.php @@ -64,7 +64,7 @@ class Upgrade { * @param array $data the data for the new cache */ function insert($data) { - if (!$this->inCache($data['storage'], $data['path_hash'])) { + if (!$this->inCache($data['storage'], $data['path_hash'], $data['id'])) { $insertQuery = \OC_DB::prepare('INSERT INTO `*PREFIX*filecache` ( `fileid`, `storage`, `path`, `path_hash`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`, `encrypted` ) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'); @@ -78,11 +78,12 @@ class Upgrade { /** * @param string $storage * @param string $pathHash + * @param string $id * @return bool */ - function inCache($storage, $pathHash) { - $query = \OC_DB::prepare('SELECT `fileid` FROM `*PREFIX*filecache` WHERE `storage` = ? AND `path_hash` = ?'); - $result = $query->execute(array($storage, $pathHash)); + function inCache($storage, $pathHash, $id) { + $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(); } |