Skip to content

Commit f543aef

Browse files
committed
chore(files_trashbin): Add user details in log from Trashbin
Signed-off-by: Louis Chemineau <[email protected]>
1 parent f50426b commit f543aef

1 file changed

Lines changed: 16 additions & 5 deletions

File tree

apps/files_trashbin/lib/Trashbin.php

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
use OCP\IConfig;
7272
use OCP\Lock\ILockingProvider;
7373
use OCP\Lock\LockedException;
74+
use OCP\Server;
7475
use Psr\Log\LoggerInterface;
7576

7677
class Trashbin {
@@ -903,7 +904,13 @@ protected static function deleteFiles(array $files, string $user, int|float $ava
903904
foreach ($files as $file) {
904905
if ($availableSpace < 0 && $expiration->isExpired($file['mtime'], true)) {
905906
$tmp = self::delete($file['name'], $user, $file['mtime']);
906-
\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']);
907+
Server::get(LoggerInterface::class)->info(
908+
'remove "' . $file['name'] . '" (' . $tmp . 'B) to meet the limit of trash bin size (50% of available quota) for user "{user}"',
909+
[
910+
'app' => 'files_trashbin',
911+
'user' => $user,
912+
]
913+
);
907914
$availableSpace += $tmp;
908915
$size += $tmp;
909916
} else {
@@ -934,16 +941,20 @@ public static function deleteExpiredFiles($files, $user) {
934941
$size += self::delete($filename, $user, $timestamp);
935942
$count++;
936943
} catch (\OCP\Files\NotPermittedException $e) {
937-
\OC::$server->get(LoggerInterface::class)->warning('Removing "' . $filename . '" from trashbin failed.',
944+
Server::get(LoggerInterface::class)->warning('Removing "' . $filename . '" from trashbin failed for user "{user}"',
938945
[
939946
'exception' => $e,
940947
'app' => 'files_trashbin',
948+
'user' => $user,
941949
]
942950
);
943951
}
944-
\OC::$server->get(LoggerInterface::class)->info(
945-
'Remove "' . $filename . '" from trashbin because it exceeds max retention obligation term.',
946-
['app' => 'files_trashbin']
952+
Server::get(LoggerInterface::class)->info(
953+
'Remove "' . $filename . '" from trashbin for user "{user}" because it exceeds max retention obligation term.',
954+
[
955+
'app' => 'files_trashbin',
956+
'user' => $user,
957+
],
947958
);
948959
} else {
949960
break;

0 commit comments

Comments
 (0)