diff options
author | Lars Knickrehm <mail@lars-sh.de> | 2018-05-28 00:59:20 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-28 00:59:20 +0200 |
commit | e360885eb0562821c7dc69e988d4aa86418e68cf (patch) | |
tree | cc9a9cd5f92dacd95505ef099afad91963f015fb /apps/files_trashbin/lib/Trashbin.php | |
parent | 9e00b51c879094a79371b0ed68065efed97a7ed5 (diff) | |
download | nextcloud-server-e360885eb0562821c7dc69e988d4aa86418e68cf.tar.gz nextcloud-server-e360885eb0562821c7dc69e988d4aa86418e68cf.zip |
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() [...]"
Diffstat (limited to 'apps/files_trashbin/lib/Trashbin.php')
-rw-r--r-- | apps/files_trashbin/lib/Trashbin.php | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/apps/files_trashbin/lib/Trashbin.php b/apps/files_trashbin/lib/Trashbin.php index bf396d40abf..eb1a6f704fd 100644 --- a/apps/files_trashbin/lib/Trashbin.php +++ b/apps/files_trashbin/lib/Trashbin.php @@ -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'] |