CoreCapabilities.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  5. * SPDX-License-Identifier: AGPL-3.0-only
  6. */
  7. namespace OC\OCS;
  8. use OCP\Capabilities\ICapability;
  9. use OCP\IConfig;
  10. use OCP\IURLGenerator;
  11. /**
  12. * Class Capabilities
  13. *
  14. * @package OC\OCS
  15. */
  16. class CoreCapabilities implements ICapability {
  17. /**
  18. * @param IConfig $config
  19. */
  20. public function __construct(
  21. private IConfig $config,
  22. ) {
  23. }
  24. /**
  25. * Return this classes capabilities
  26. *
  27. * @return array{
  28. * core: array{
  29. * pollinterval: int,
  30. * webdav-root: string,
  31. * reference-api: boolean,
  32. * reference-regex: string,
  33. * mod-rewrite-working: boolean,
  34. * },
  35. * }
  36. */
  37. public function getCapabilities(): array {
  38. return [
  39. 'core' => [
  40. 'pollinterval' => $this->config->getSystemValueInt('pollinterval', 60),
  41. 'webdav-root' => $this->config->getSystemValueString('webdav-root', 'remote.php/webdav'),
  42. 'reference-api' => true,
  43. 'reference-regex' => IURLGenerator::URL_REGEX_NO_MODIFIERS,
  44. 'mod-rewrite-working' => $this->config->getSystemValueBool('htaccess.IgnoreFrontController') || getenv('front_controller_active') === 'true',
  45. ],
  46. ];
  47. }
  48. }