diff options
author | Robin Appelman <robin@icewind.nl> | 2022-03-31 14:10:20 +0200 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2022-03-31 14:35:42 +0200 |
commit | ac657b0f06fea0b24c01eb47b40a28591c0b4528 (patch) | |
tree | 482a0a1091f82e093cf236cce11ce8a241104c32 /lib/private/Files/Cache/Storage.php | |
parent | 39494fbf794d982f6f6551c984e6ca4c4e947d01 (diff) | |
download | nextcloud-server-ac657b0f06fea0b24c01eb47b40a28591c0b4528.tar.gz nextcloud-server-ac657b0f06fea0b24c01eb47b40a28591c0b4528.zip |
cache storage id mapping both ways
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'lib/private/Files/Cache/Storage.php')
-rw-r--r-- | lib/private/Files/Cache/Storage.php | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/lib/private/Files/Cache/Storage.php b/lib/private/Files/Cache/Storage.php index 2de2c2f84d7..e977e29ce7d 100644 --- a/lib/private/Files/Cache/Storage.php +++ b/lib/private/Files/Cache/Storage.php @@ -126,19 +126,9 @@ class Storage { * @param int $numericId * @return string|null either the storage id string or null if the numeric id is not known */ - public static function getStorageId($numericId) { - $query = \OC::$server->getDatabaseConnection()->getQueryBuilder(); - $query->select('id') - ->from('storages') - ->where($query->expr()->eq('numeric_id', $query->createNamedParameter($numericId))); - $result = $query->execute(); - $row = $result->fetch(); - $result->closeCursor(); - if ($row) { - return $row['id']; - } else { - return null; - } + public static function getStorageId(int $numericId): ?string { + $storage = self::getGlobalCache()->getStorageInfoByNumericId($numericId); + return $storage['id'] ?? null; } /** |