aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorFerdinand Thiessen <opensource@fthiessen.de>2024-09-15 01:45:51 +0200
committerFerdinand Thiessen <opensource@fthiessen.de>2024-09-19 00:35:21 +0200
commit74923d174bcf5ec4f9484de9f51bf55141b5918b (patch)
treee70729e8bc058e5036ad9f173cfa3ee485368f8f /lib
parent8b79283c6bcd045c16a869fc79dce1e2f582601f (diff)
downloadnextcloud-server-74923d174bcf5ec4f9484de9f51bf55141b5918b.tar.gz
nextcloud-server-74923d174bcf5ec4f9484de9f51bf55141b5918b.zip
refactor(OC_Files): Remove deprecated ILogger
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/legacy/OC_Files.php16
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/private/legacy/OC_Files.php b/lib/private/legacy/OC_Files.php
index 8e23d70c690..126472e3061 100644
--- a/lib/private/legacy/OC_Files.php
+++ b/lib/private/legacy/OC_Files.php
@@ -7,12 +7,14 @@
*/
use bantu\IniGetWrapper\IniGetWrapper;
use OC\Files\View;
+use OC\HintException;
use OC\Streamer;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\Events\BeforeDirectFileDownloadEvent;
use OCP\Files\Events\BeforeZipCreatedEvent;
use OCP\Files\IRootFolder;
use OCP\Lock\ILockingProvider;
+use Psr\Log\LoggerInterface;
/**
* Class for file server access
@@ -165,7 +167,7 @@ class OC_Files {
$fileTime = $file->getMTime();
} else {
// File is not a file? …
- \OC::$server->getLogger()->debug(
+ \OCP\Server::get(LoggerInterface::class)->debug(
'File given, but no Node available. Name {file}',
[ 'app' => 'files', 'file' => $file ]
);
@@ -186,25 +188,25 @@ class OC_Files {
self::unlockAllTheFiles($dir, $files, $getType, $view, $filename);
} catch (\OCP\Lock\LockedException $ex) {
self::unlockAllTheFiles($dir, $files, $getType, $view, $filename);
- OC::$server->getLogger()->logException($ex);
+ \OCP\Server::get(LoggerInterface::class)->error('File is currently busy', ['exception' => $ex]);
$l = \OC::$server->getL10N('lib');
- $hint = method_exists($ex, 'getHint') ? $ex->getHint() : '';
+ $hint = $ex instanceof HintException ? $ex->getHint() : '';
\OC_Template::printErrorPage($l->t('File is currently busy, please try again later'), $hint, 200);
} catch (\OCP\Files\ForbiddenException $ex) {
self::unlockAllTheFiles($dir, $files, $getType, $view, $filename);
- OC::$server->getLogger()->logException($ex);
+ \OCP\Server::get(LoggerInterface::class)->error('Cannot download file', ['exception' => $ex]);
$l = \OC::$server->getL10N('lib');
\OC_Template::printErrorPage($l->t('Cannot download file'), $ex->getMessage(), 200);
} catch (\OCP\Files\ConnectionLostException $ex) {
self::unlockAllTheFiles($dir, $files, $getType, $view, $filename);
- OC::$server->getLogger()->logException($ex, ['level' => \OCP\ILogger::DEBUG]);
+ \OCP\Server::get(LoggerInterface::class)->debug('Connection lost', ['exception' => $ex]);
/* We do not print anything here, the connection is already closed */
die();
} catch (\Exception $ex) {
self::unlockAllTheFiles($dir, $files, $getType, $view, $filename);
- OC::$server->getLogger()->logException($ex);
+ \OCP\Server::get(LoggerInterface::class)->error('Cannot download file', ['exception' => $ex]);
$l = \OC::$server->getL10N('lib');
- $hint = method_exists($ex, 'getHint') ? $ex->getHint() : '';
+ $hint = $ex instanceof HintException ? $ex->getHint() : '';
if ($event && $event->getErrorMessage() !== null) {
$hint .= ' ' . $event->getErrorMessage();
}