Parcourir la source

Merge pull request #17276 from nextcloud/storage-id-eq

Get single storage id using `eq` instead of `in`
tags/v18.0.0beta1
Roeland Jago Douma il y a 4 ans
Parent
révision
5917644536
Aucun compte lié à l'adresse e-mail de l'auteur

+ 1
- 1
lib/private/Files/Cache/Storage.php Voir le fichier

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

+ 9
- 1
lib/private/Files/Cache/StorageGlobal.php Voir le fichier

@@ -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;
}

Chargement…
Annuler
Enregistrer