From 1a8f9b8b1dae03ac8784f98f416bac2e1bb6ce7a Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Tue, 24 Sep 2019 13:55:37 +0200 Subject: log which storage id can't be inserted Signed-off-by: Robin Appelman --- lib/private/Files/Cache/Storage.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') 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); } } } -- cgit v1.2.3 From bde791cec95d6861856bb33b7bd3dcc629f593c9 Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Tue, 24 Sep 2019 19:22:36 +0200 Subject: use eq instead of in for loading single storage Signed-off-by: Robin Appelman --- lib/private/Files/Cache/StorageGlobal.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'lib') 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; } -- cgit v1.2.3