mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
fix: log when user is marked as needing share mount refresh
Signed-off-by: Robin Appelman <robin@icewind.nl>
This commit is contained in:
parent
86e83b789c
commit
dba7902748
2 changed files with 10 additions and 0 deletions
|
|
@ -27,6 +27,7 @@ use OCP\Share\Events\ShareMovedEvent;
|
|||
use OCP\Share\Events\ShareTransferredEvent;
|
||||
use OCP\Share\IManager;
|
||||
use Psr\Clock\ClockInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
|
||||
/**
|
||||
* Listen to various events that can change what shares a user has access to
|
||||
|
|
@ -51,6 +52,7 @@ class SharesUpdatedListener implements IEventListener {
|
|||
private readonly ShareRecipientUpdater $shareUpdater,
|
||||
private readonly IUserConfig $userConfig,
|
||||
private readonly ClockInterface $clock,
|
||||
private readonly LoggerInterface $logger,
|
||||
IAppConfig $appConfig,
|
||||
) {
|
||||
$this->cutOffMarkTime = $appConfig->getValueFloat(Application::APP_ID, ConfigLexicon::UPDATE_CUTOFF_TIME, 3.0);
|
||||
|
|
@ -124,6 +126,9 @@ class SharesUpdatedListener implements IEventListener {
|
|||
}
|
||||
|
||||
private function markUserForRefresh(IUser $user): void {
|
||||
// log with exception to capture the trace
|
||||
$ex = new \Exception('Marking ' . $user->getUID() . ' as needing the share mounts refreshed');
|
||||
$this->logger->debug($ex->getMessage(), ['exception' => $ex]);
|
||||
$this->userConfig->setValueBool($user->getUID(), Application::APP_ID, ConfigLexicon::USER_NEEDS_SHARE_REFRESH, true);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ use OCP\Share\IShare;
|
|||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use Psr\Clock\ClockInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Test\Mock\Config\MockAppConfig;
|
||||
use Test\Mock\Config\MockUserConfig;
|
||||
use Test\Traits\UserTrait;
|
||||
|
|
@ -34,6 +35,7 @@ class SharesUpdatedListenerTest extends \Test\TestCase {
|
|||
private IUserConfig $userConfig;
|
||||
private IAppConfig $appConfig;
|
||||
private ClockInterface&MockObject $clock;
|
||||
private LoggerInterface&MockObject $logger;
|
||||
private $clockFn;
|
||||
|
||||
protected function setUp(): void {
|
||||
|
|
@ -54,11 +56,14 @@ class SharesUpdatedListenerTest extends \Test\TestCase {
|
|||
// extra wrapper so we can modify clockFn
|
||||
return ($this->clockFn)();
|
||||
});
|
||||
$this->logger = $this->createMock(LoggerInterface::class);
|
||||
|
||||
$this->sharesUpdatedListener = new SharesUpdatedListener(
|
||||
$this->manager,
|
||||
$this->shareRecipientUpdater,
|
||||
$this->userConfig,
|
||||
$this->clock,
|
||||
$this->logger,
|
||||
$this->appConfig,
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue