diff options
Diffstat (limited to 'lib/private/Files/Cache/Storage.php')
-rw-r--r-- | lib/private/Files/Cache/Storage.php | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/private/Files/Cache/Storage.php b/lib/private/Files/Cache/Storage.php index 8a076084ac5..b2bb8fd0078 100644 --- a/lib/private/Files/Cache/Storage.php +++ b/lib/private/Files/Cache/Storage.php @@ -40,10 +40,22 @@ namespace OC\Files\Cache; * @package OC\Files\Cache */ class Storage { + /** @var StorageGlobal|null */ + private static $globalCache = null; private $storageId; private $numericId; /** + * @return StorageGlobal + */ + public static function getGlobalCache() { + if (is_null(self::$globalCache)) { + self::$globalCache = new StorageGlobal(\OC::$server->getDatabaseConnection()); + } + return self::$globalCache; + } + + /** * @param \OC\Files\Storage\Storage|string $storage * @param bool $isAvailable * @throws \RuntimeException @@ -75,12 +87,10 @@ class Storage { /** * @param string $storageId - * @return array|null + * @return array */ public static function getStorageById($storageId) { - $sql = 'SELECT * FROM `*PREFIX*storages` WHERE `id` = ?'; - $result = \OC_DB::executeAudited($sql, array($storageId)); - return $result->fetchRow(); + return self::getGlobalCache()->getStorageInfo($storageId); } /** |