diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2019-10-09 15:17:49 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-09 15:17:49 +0200 |
commit | 591764453603cef2634ced444a596ca7de7c0d95 (patch) | |
tree | 989e2f9ae33f4ec01559c9b555aee9a36be7ac2e /lib/private | |
parent | fa7eb52092552764ba7f7e5a3f339b220a746118 (diff) | |
parent | bde791cec95d6861856bb33b7bd3dcc629f593c9 (diff) | |
download | nextcloud-server-591764453603cef2634ced444a596ca7de7c0d95.tar.gz nextcloud-server-591764453603cef2634ced444a596ca7de7c0d95.zip |
Merge pull request #17276 from nextcloud/storage-id-eq
Get single storage id using `eq` instead of `in`
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/Files/Cache/Storage.php | 2 | ||||
-rw-r--r-- | lib/private/Files/Cache/StorageGlobal.php | 10 |
2 files changed, 10 insertions, 2 deletions
diff --git a/lib/private/Files/Cache/Storage.php b/lib/private/Files/Cache/Storage.php index 72aaac11c54..c076cc28359 100644 --- a/lib/private/Files/Cache/Storage.php +++ b/lib/private/Files/Cache/Storage.php @@ -81,7 +81,7 @@ class Storage { if ($row = self::getStorageById($this->storageId)) { $this->numericId = (int)$row['numeric_id']; } else { - throw new \RuntimeException('Storage could neither be inserted nor be selected from the database'); + throw new \RuntimeException('Storage could neither be inserted nor be selected from the database: ' . $this->storageId); } } } diff --git a/lib/private/Files/Cache/StorageGlobal.php b/lib/private/Files/Cache/StorageGlobal.php index 65f689f1874..076b5b8f53d 100644 --- a/lib/private/Files/Cache/StorageGlobal.php +++ b/lib/private/Files/Cache/StorageGlobal.php @@ -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; } |