Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
only get logger when needed in sabre/directory
Signed-off-by: Robin Appelman <[email protected]>
  • Loading branch information
icewind1991 committed Sep 7, 2023
commit 9242e8939fefc97aece696ea5c190029b5ed43c7
17 changes: 8 additions & 9 deletions apps/dav/lib/Connector/Sabre/Directory.php
Original file line number Diff line number Diff line change
Expand Up @@ -315,20 +315,19 @@ public function delete() {
}
}

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

Expand All @@ -345,13 +344,13 @@ public function getQuotaInfo() {
];
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];
}
}
Expand Down