From 10576ba0611190ac1623a368881c905a3f4010bb Mon Sep 17 00:00:00 2001 From: Git'Fellow <12234510+solracsf@users.noreply.github.com> Date: Mon, 29 Jul 2024 14:37:52 +0200 Subject: [PATCH] fix: don't use OCP Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com> --- lib/private/Files/Storage/Local.php | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/private/Files/Storage/Local.php b/lib/private/Files/Storage/Local.php index 0b4ece1eea5b7..7921fae1afe8a 100644 --- a/lib/private/Files/Storage/Local.php +++ b/lib/private/Files/Storage/Local.php @@ -18,7 +18,6 @@ use OCP\Files\StorageNotAvailableException; use OCP\IConfig; use OCP\Util; -use OCP\Server; use Psr\Log\LoggerInterface; /** @@ -332,17 +331,17 @@ public function rename($source, $target): bool { $dstParent = dirname($target); if (!$this->isUpdatable($srcParent)) { - Server:get(LoggerInterface::class)->error('unable to rename, source directory is not writable : ' . $srcParent, ['app' => 'core']); + \OC::$server->get(LoggerInterface::class)->error('unable to rename, source directory is not writable : ' . $srcParent, ['app' => 'core']); return false; } if (!$this->isUpdatable($dstParent)) { - Server:get(LoggerInterface::class)->error('unable to rename, destination directory is not writable : ' . $dstParent, ['app' => 'core']); + \OC::$server->get(LoggerInterface::class)->error('unable to rename, destination directory is not writable : ' . $dstParent, ['app' => 'core']); return false; } if (!$this->file_exists($source)) { - Server:get(LoggerInterface::class)->error('unable to rename, file does not exists : ' . $source, ['app' => 'core']); + \OC::$server->get(LoggerInterface::class)->error('unable to rename, file does not exists : ' . $source, ['app' => 'core']); return false; } @@ -404,18 +403,18 @@ public function fopen($path, $mode) { public function hash($type, $path, $raw = false): string|bool { $sourcePath = $this->getSourcePath($path); if ($sourcePath === null) { - Server:get(LoggerInterface::class)->error('Source path returned null for path: ' . $sourcePath, ['app' => 'core']); + \OC::$server->get(LoggerInterface::class)->error('Source path returned null for path: ' . $sourcePath, ['app' => 'core']); return false; } if (!file_exists($sourcePath) || !is_readable($sourcePath)) { - Server:get(LoggerInterface::class)->error('Source path does not exist or is not readable: ' . $sourcePath, ['app' => 'core']); + \OC::$server->get(LoggerInterface::class)->error('Source path does not exist or is not readable: ' . $sourcePath, ['app' => 'core']); return false; } $validAlgorithms = hash_algos(); if (!in_array($type, $validAlgorithms)) { - Server:get(LoggerInterface::class)->error('Invalid hash algorithm: ' . $type, ['app' => 'core']); + \OC::$server->get(LoggerInterface::class)->error('Invalid hash algorithm: ' . $type, ['app' => 'core']); return false; } @@ -520,7 +519,7 @@ public function getSourcePath($path) { return $fullPath; } - Server:get(LoggerInterface::class)->error("Following symlinks is not allowed ('$fullPath' -> '$realPath' not inside '{$this->realDataDir}')", ['app' => 'core']); + \OC::$server->get(LoggerInterface::class)->error("Following symlinks is not allowed ('$fullPath' -> '$realPath' not inside '{$this->realDataDir}')", ['app' => 'core']); throw new ForbiddenException('Following symlinks is not allowed', false); }