1
0

NeedsSystemAddressBookSync.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCA\DAV\SetupChecks;
  8. use OCP\IConfig;
  9. use OCP\IL10N;
  10. use OCP\SetupCheck\ISetupCheck;
  11. use OCP\SetupCheck\SetupResult;
  12. class NeedsSystemAddressBookSync implements ISetupCheck {
  13. public function __construct(
  14. private IConfig $config,
  15. private IL10N $l10n,
  16. ) {
  17. }
  18. public function getName(): string {
  19. return $this->l10n->t('DAV system address book');
  20. }
  21. public function getCategory(): string {
  22. return 'dav';
  23. }
  24. public function run(): SetupResult {
  25. if ($this->config->getAppValue('dav', 'needs_system_address_book_sync', 'no') === 'no') {
  26. return SetupResult::success($this->l10n->t('No outstanding DAV system address book sync.'));
  27. } else {
  28. return SetupResult::warning($this->l10n->t('The DAV system address book sync has not run yet as your instance has more than 1000 users or because an error occurred. Please run it manually by calling "occ dav:sync-system-addressbook".'));
  29. }
  30. }
  31. }