setTimeSensitivity(IJob::TIME_INSENSITIVE); $this->setInterval(24 * 3600); } protected function run($argument): void { $backend = new PartiallyDeletedUsersBackend($this->config); $users = $backend->getUsers(); if (empty($users)) { $this->logger->debug('No failed deleted users found.'); return; } foreach ($users as $userId) { if ($this->userManager->userExists($userId)) { $this->logger->info('Skipping user {userId}, marked as deleted, as they still exists in user backend.', ['userId' => $userId]); $backend->unmarkUser($userId); continue; } try { $user = new User( $userId, $backend, \OCP\Server::get(IEventDispatcher::class), $this->userManager, $this->config, ); $user->delete(); $this->logger->info('Cleaned up deleted user {userId}', ['userId' => $userId]); } catch (\Throwable $error) { $this->logger->warning('Could not cleanup deleted user {userId}', ['userId' => $userId, 'exception' => $error]); } } } }