1
0

PhpDefaultCharset.php 814 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCA\Settings\SetupChecks;
  8. use OCP\IL10N;
  9. use OCP\SetupCheck\ISetupCheck;
  10. use OCP\SetupCheck\SetupResult;
  11. class PhpDefaultCharset implements ISetupCheck {
  12. public function __construct(
  13. private IL10N $l10n,
  14. ) {
  15. }
  16. public function getName(): string {
  17. return $this->l10n->t('PHP default charset');
  18. }
  19. public function getCategory(): string {
  20. return 'php';
  21. }
  22. public function run(): SetupResult {
  23. if (strtoupper(trim(ini_get('default_charset'))) === 'UTF-8') {
  24. return SetupResult::success('UTF-8');
  25. } else {
  26. return SetupResult::warning($this->l10n->t('PHP configuration option "default_charset" should be UTF-8'));
  27. }
  28. }
  29. }