Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_trashbin/lib/Trashbin.php')
-rw-r--r--apps/files_trashbin/lib/Trashbin.php22
1 files changed, 14 insertions, 8 deletions
diff --git a/apps/files_trashbin/lib/Trashbin.php b/apps/files_trashbin/lib/Trashbin.php
index 6aec2f9821e..4631f9e9d5b 100644
--- a/apps/files_trashbin/lib/Trashbin.php
+++ b/apps/files_trashbin/lib/Trashbin.php
@@ -60,6 +60,7 @@ use OCP\Files\NotFoundException;
use OCP\Files\NotPermittedException;
use OCP\Lock\ILockingProvider;
use OCP\Lock\LockedException;
+use Psr\Log\LoggerInterface;
class Trashbin {
@@ -227,7 +228,7 @@ class Trashbin {
->setValue('user', $query->createNamedParameter($user));
$result = $query->executeStatement();
if (!$result) {
- \OC::$server->getLogger()->error('trash bin database couldn\'t be updated for the files owner', ['app' => 'files_trashbin']);
+ \OC::$server->get(LoggerInterface::class)->error('trash bin database couldn\'t be updated for the files owner', ['app' => 'files_trashbin']);
}
}
}
@@ -326,7 +327,7 @@ class Trashbin {
if ($trashStorage->file_exists($trashInternalPath)) {
$trashStorage->unlink($trashInternalPath);
}
- \OC::$server->getLogger()->error('Couldn\'t move ' . $file_path . ' to the trash bin', ['app' => 'files_trashbin']);
+ \OC::$server->get(LoggerInterface::class)->error('Couldn\'t move ' . $file_path . ' to the trash bin', ['app' => 'files_trashbin']);
}
if ($sourceStorage->file_exists($sourceInternalPath)) { // failed to delete the original file, abort
@@ -354,7 +355,7 @@ class Trashbin {
->setValue('user', $query->createNamedParameter($owner));
$result = $query->executeStatement();
if (!$result) {
- \OC::$server->getLogger()->error('trash bin database couldn\'t be updated', ['app' => 'files_trashbin']);
+ \OC::$server->get(LoggerInterface::class)->error('trash bin database couldn\'t be updated', ['app' => 'files_trashbin']);
}
\OCP\Util::emitHook('\OCA\Files_Trashbin\Trashbin', 'post_moveToTrash', ['filePath' => Filesystem::normalizePath($file_path),
'trashPath' => Filesystem::normalizePath($filename . '.d' . $timestamp)]);
@@ -470,7 +471,7 @@ class Trashbin {
if ($timestamp) {
$location = self::getLocation($user, $filename, $timestamp);
if ($location === false) {
- \OC::$server->getLogger()->error('trash bin database inconsistent! ($user: ' . $user . ' $filename: ' . $filename . ', $timestamp: ' . $timestamp . ')', ['app' => 'files_trashbin']);
+ \OC::$server->get(LoggerInterface::class)->error('trash bin database inconsistent! ($user: ' . $user . ' $filename: ' . $filename . ', $timestamp: ' . $timestamp . ')', ['app' => 'files_trashbin']);
} else {
// if location no longer exists, restore file in the root directory
if ($location !== '/' &&
@@ -870,7 +871,7 @@ class Trashbin {
foreach ($files as $file) {
if ($availableSpace < 0 && $expiration->isExpired($file['mtime'], true)) {
$tmp = self::delete($file['name'], $user, $file['mtime']);
- \OC::$server->getLogger()->info('remove "' . $file['name'] . '" (' . $tmp . 'B) to meet the limit of trash bin size (50% of available quota)', ['app' => 'files_trashbin']);
+ \OC::$server->get(LoggerInterface::class)->info('remove "' . $file['name'] . '" (' . $tmp . 'B) to meet the limit of trash bin size (50% of available quota)', ['app' => 'files_trashbin']);
$availableSpace += $tmp;
$size += $tmp;
} else {
@@ -901,9 +902,14 @@ class Trashbin {
$size += self::delete($filename, $user, $timestamp);
$count++;
} catch (\OCP\Files\NotPermittedException $e) {
- \OC::$server->getLogger()->logException($e, ['app' => 'files_trashbin', 'level' => \OCP\ILogger::WARN, 'message' => 'Removing "' . $filename . '" from trashbin failed.']);
+ \OC::$server->get(LoggerInterface::class)->warning('Removing "' . $filename . '" from trashbin failed.',
+ [
+ 'exception' => $e,
+ 'app' => 'files_trashbin',
+ ]
+ );
}
- \OC::$server->getLogger()->info(
+ \OC::$server->get(LoggerInterface::class)->info(
'Remove "' . $filename . '" from trashbin because it exceeds max retention obligation term.',
['app' => 'files_trashbin']
);
@@ -999,7 +1005,7 @@ class Trashbin {
$query = new CacheQueryBuilder(
\OC::$server->getDatabaseConnection(),
\OC::$server->getSystemConfig(),
- \OC::$server->getLogger()
+ \OC::$server->get(LoggerInterface::class)
);
$normalizedParentPath = ltrim(Filesystem::normalizePath(dirname('files_trashbin/versions/'. $filename)), '/');
$parentId = $cache->getId($normalizedParentPath);