diff --git a/apps/files_trashbin/lib/Trashbin.php b/apps/files_trashbin/lib/Trashbin.php index 00e6b35cc6297..07eeb605124f4 100644 --- a/apps/files_trashbin/lib/Trashbin.php +++ b/apps/files_trashbin/lib/Trashbin.php @@ -237,6 +237,8 @@ private static function copyFilesToUser($sourcePath, $owner, $targetPath, $user, * @return bool */ public static function move2trash($file_path, $ownerOnly = false) { + /** @var LoggerInterface $logger */ + $logger = \OC::$server->get(LoggerInterface::class); // get the user for which the filesystem is setup $root = Filesystem::getRoot(); [, $user] = explode('/', $root); @@ -252,12 +254,14 @@ public static function move2trash($file_path, $ownerOnly = false) { // file has been deleted in between if (is_null($ownerPath) || $ownerPath === '') { + $logger->warning("Failed to get owner for $file_path while moving to trashbin", ['app' => 'files_trashbin']); return true; } $sourceInfo = $ownerView->getFileInfo('/files/' . $ownerPath); if ($sourceInfo === false) { + $logger->warning("Failed to find $file_path while moving to trashbin", ['app' => 'files_trashbin']); return true; } @@ -310,6 +314,7 @@ public static function move2trash($file_path, $ownerOnly = false) { $userTrashbinSize = (int)$config->getUserValue($owner, 'files_trashbin', 'trashbin_size', '-1'); $configuredTrashbinSize = ($userTrashbinSize < 0) ? $systemTrashbinSize : $userTrashbinSize; if ($configuredTrashbinSize >= 0 && $sourceInfo->getSize() >= $configuredTrashbinSize) { + $logger->warning("Skipping trashbin because $file_path is larger(" . $sourceInfo->getSize() . ") than the configured trashbin limit of " . $configuredTrashbinSize, ['app' => 'files_trashbin']); return false; } @@ -331,6 +336,7 @@ public static function move2trash($file_path, $ownerOnly = false) { } if ($sourceStorage->file_exists($sourceInternalPath)) { // failed to delete the original file, abort + $logger->warning("$file_path still exists after we tried to move it to the trashbin", ['app' => 'files_trashbin']); if ($sourceStorage->is_dir($sourceInternalPath)) { $sourceStorage->rmdir($sourceInternalPath); } else {