DebugMode.php 927 B

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 DebugMode 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('Debug mode');
  20. }
  21. public function getCategory(): string {
  22. return 'system';
  23. }
  24. public function run(): SetupResult {
  25. if ($this->config->getSystemValueBool('debug', false)) {
  26. return SetupResult::warning($this->l10n->t('This instance is running in debug mode. Only enable this for local development and not in production environments.'));
  27. } else {
  28. return SetupResult::success($this->l10n->t('Debug mode is disabled.'));
  29. }
  30. }
  31. }