diff options
author | Robin Appelman <robin@icewind.nl> | 2023-08-15 18:31:40 +0200 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2023-09-07 16:25:16 +0200 |
commit | 9242e8939fefc97aece696ea5c190029b5ed43c7 (patch) | |
tree | 70cbf3d69fd89434e905b563f29610fae8a64354 /apps | |
parent | a23447c050910ec1403d478b62203fdb37702ee4 (diff) | |
download | nextcloud-server-9242e8939fefc97aece696ea5c190029b5ed43c7.tar.gz nextcloud-server-9242e8939fefc97aece696ea5c190029b5ed43c7.zip |
only get logger when needed in sabre/directory
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/dav/lib/Connector/Sabre/Directory.php | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/apps/dav/lib/Connector/Sabre/Directory.php b/apps/dav/lib/Connector/Sabre/Directory.php index c29070fe921..4367eabdbef 100644 --- a/apps/dav/lib/Connector/Sabre/Directory.php +++ b/apps/dav/lib/Connector/Sabre/Directory.php @@ -315,20 +315,19 @@ class Directory extends \OCA\DAV\Connector\Sabre\Node implements \Sabre\DAV\ICol } } + private function getLogger(): LoggerInterface { + return \OC::$server->get(LoggerInterface::class); + } + /** * Returns available diskspace information * * @return array */ public function getQuotaInfo() { - /** @var LoggerInterface $logger */ - $logger = \OC::$server->get(LoggerInterface::class); - if ($this->quotaInfo) { - return $this->quotaInfo; - } $relativePath = $this->fileView->getRelativePath($this->info->getPath()); if ($relativePath === null) { - $logger->warning("error while getting quota as the relative path cannot be found"); + $this->getLogger()->warning("error while getting quota as the relative path cannot be found"); return [0, 0]; } @@ -345,13 +344,13 @@ class Directory extends \OCA\DAV\Connector\Sabre\Node implements \Sabre\DAV\ICol ]; return $this->quotaInfo; } catch (\OCP\Files\NotFoundException $e) { - $logger->warning("error while getting quota into", ['exception' => $e]); + $this->getLogger()->warning("error while getting quota into", ['exception' => $e]); return [0, 0]; } catch (\OCP\Files\StorageNotAvailableException $e) { - $logger->warning("error while getting quota into", ['exception' => $e]); + $this->getLogger()->warning("error while getting quota into", ['exception' => $e]); return [0, 0]; } catch (NotPermittedException $e) { - $logger->warning("error while getting quota into", ['exception' => $e]); + $this->getLogger()->warning("error while getting quota into", ['exception' => $e]); return [0, 0]; } } |