ReadOnlyConfig.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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\Settings\SetupChecks;
  8. use OCP\IConfig;
  9. use OCP\IL10N;
  10. use OCP\SetupCheck\ISetupCheck;
  11. use OCP\SetupCheck\SetupResult;
  12. class ReadOnlyConfig implements ISetupCheck {
  13. public function __construct(
  14. private IL10N $l10n,
  15. private IConfig $config,
  16. ) {
  17. }
  18. public function getName(): string {
  19. return $this->l10n->t('Configuration file access rights');
  20. }
  21. public function getCategory(): string {
  22. return 'config';
  23. }
  24. public function run(): SetupResult {
  25. if ($this->config->getSystemValueBool('config_is_read_only', false)) {
  26. return SetupResult::info($this->l10n->t('The read-only config has been enabled. This prevents setting some configurations via the web-interface. Furthermore, the file needs to be made writable manually for every update.'));
  27. } else {
  28. return SetupResult::success($this->l10n->t('Nextcloud configuration file is writable'));
  29. }
  30. }
  31. }