0
0
Fork 0
mirror of https://github.com/nextcloud/server.git synced 2025-03-12 15:37:27 +00:00
nextcloud_server/core/BackgroundJobs/LookupServerSendCheckBackgroundJob.php
Ferdinand Thiessen 16ef867418 fix(lookup-server): Only flag new users for lookup update / delete
If the flag was already set then we do not need to overwrite it.

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2025-03-12 08:04:53 +00:00

38 lines
1 KiB
PHP

<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OC\Core\BackgroundJobs;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\QueuedJob;
use OCP\IConfig;
use OCP\IUser;
use OCP\IUserManager;
class LookupServerSendCheckBackgroundJob extends QueuedJob {
public function __construct(
protected IConfig $config,
private IUserManager $userManager,
ITimeFactory $time,
) {
parent::__construct($time);
}
/**
* @param array $argument
*/
public function run($argument): void {
$this->userManager->callForSeenUsers(function (IUser $user) {
// If the user data was not updated yet (check if LUS is enabled and if then update on LUS or delete on LUS)
// then we need to flag the user data to be checked
if ($this->config->getUserValue($user->getUID(), 'lookup_server_connector', 'dataSend', '') === '') {
$this->config->setUserValue($user->getUID(), 'lookup_server_connector', 'dataSend', '1');
}
});
}
}