1
0

UpdateGroups.php 957 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  6. * SPDX-License-Identifier: AGPL-3.0-only
  7. */
  8. namespace OCA\User_LDAP\Jobs;
  9. use OCA\User_LDAP\Service\UpdateGroupsService;
  10. use OCP\AppFramework\Utility\ITimeFactory;
  11. use OCP\BackgroundJob\TimedJob;
  12. use OCP\DB\Exception;
  13. use OCP\IConfig;
  14. use Psr\Log\LoggerInterface;
  15. class UpdateGroups extends TimedJob {
  16. public function __construct(
  17. private UpdateGroupsService $service,
  18. private LoggerInterface $logger,
  19. IConfig $config,
  20. ITimeFactory $timeFactory,
  21. ) {
  22. parent::__construct($timeFactory);
  23. $this->interval = (int)$config->getAppValue('user_ldap', 'bgjRefreshInterval', '3600');
  24. }
  25. /**
  26. * @param mixed $argument
  27. * @throws Exception
  28. */
  29. public function run($argument): void {
  30. $this->logger->debug('Run background job "updateGroups"');
  31. $this->service->updateGroups();
  32. }
  33. }