Workaround for interrupting expired files deletion

Workaround avoiding "Error while running background job (class: OCA\Files_Trashbin\BackgroundJob\ExpireTrash, arguments: ): {"Exception":"OCP\\Files\\NotPermittedException","Message":"","Code":0,"Trace":"#0 \/var\/www\/cloud\/apps\/files_trashbin\/lib\/Trashbin.php(590): OC\\Files\\Node\\File->delete() [...]"
This commit is contained in:
Lars Knickrehm 2018-05-28 00:59:20 +02:00 committed by GitHub
parent 9e00b51c87
commit e360885eb0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -790,8 +790,15 @@ class Trashbin {
$timestamp = $file['mtime'];
$filename = $file['name'];
if ($expiration->isExpired($timestamp)) {
$count++;
$size += self::delete($filename, $user, $timestamp);
try {
$size += self::delete($filename, $user, $timestamp);
$count++;
} catch (\OCP\Files\NotPermittedException $e) {
\OC::$server->getLogger()->warning(
'Removing "' . $filename . '" from trashbin failed (OCP\\Files\\NotPermittedException).',
['app' => 'files_trashbin']
);
}
\OC::$server->getLogger()->info(
'Remove "' . $filename . '" from trashbin because it exceeds max retention obligation term.',
['app' => 'files_trashbin']