Skip to content

Commit

Permalink
fix: log when no trash item is found
Browse files Browse the repository at this point in the history
Signed-off-by: Robin Appelman <[email protected]>
  • Loading branch information
icewind1991 authored and skjnldsv committed Aug 28, 2024
1 parent ac88cd2 commit 5e73f4a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/ACL/ACLManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
use OCP\Constants;
use OCP\Files\IRootFolder;
use OCP\IUser;
use Psr\Log\LoggerInterface;

class ACLManager {
private CappedMemoryCache $ruleCache;
Expand All @@ -37,6 +38,7 @@ class ACLManager {
public function __construct(
private RuleManager $ruleManager,
private TrashManager $trashManager,
private LoggerInterface $logger,
private IUser $user,
callable $rootFolderProvider,
private ?int $rootStorageId = null,
Expand Down Expand Up @@ -121,6 +123,8 @@ private function getRelevantPaths(string $path): array {
if ($trashItemRow) {
$path = dirname('__groupfolders/' . $groupFolderId . '/' . $trashItemRow['original_location']);
continue;
} else {
$this->logger->warning("failed to find trash item for $rootTrashedItemName deleted at $rootTrashedItemDate in folder $groupFolderId", ['app' => 'groupfolders']);
}
}

Expand Down
3 changes: 3 additions & 0 deletions lib/ACL/ACLManagerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
use OCA\GroupFolders\Trash\TrashManager;
use OCP\IConfig;
use OCP\IUser;
use Psr\Log\LoggerInterface;

class ACLManagerFactory {
private $rootFolderProvider;
Expand All @@ -34,6 +35,7 @@ public function __construct(
private RuleManager $ruleManager,
private TrashManager $trashManager,
private IConfig $config,
private LoggerInterface $logger,
callable $rootFolderProvider,
) {
$this->rootFolderProvider = $rootFolderProvider;
Expand All @@ -43,6 +45,7 @@ public function getACLManager(IUser $user, ?int $rootStorageId = null): ACLManag
return new ACLManager(
$this->ruleManager,
$this->trashManager,
$this->logger,
$user,
$this->rootFolderProvider,
$rootStorageId,
Expand Down
1 change: 1 addition & 0 deletions lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ public function register(IRegistrationContext $context): void {
$c->get(RuleManager::class),
$c->get(TrashManager::class),
$c->get(IConfig::class),
$c->get(LoggerInterface::class),
$rootFolderProvider
);
});
Expand Down

0 comments on commit 5e73f4a

Please sign in to comment.