use eq instead of in for loading single storage

Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
Robin Appelman 2019-09-24 19:22:36 +02:00
parent 84b9e9f1ae
commit 70ae096563
No known key found for this signature in database
GPG Key ID: 42B69D8A64526EFB
1 changed files with 9 additions and 1 deletions

View File

@ -69,7 +69,15 @@ class StorageGlobal {
*/
public function getStorageInfo($storageId) {
if (!isset($this->cache[$storageId])) {
$this->loadForStorageIds([$storageId]);
$builder = $this->connection->getQueryBuilder();
$query = $builder->select(['id', 'numeric_id', 'available', 'last_checked'])
->from('storages')
->where($builder->expr()->eq('id', $builder->createNamedParameter($storageId)));
$row = $query->execute()->fetch();
if ($row) {
$this->cache[$storageId] = $row;
}
}
return isset($this->cache[$storageId]) ? $this->cache[$storageId] : null;
}