1
0

PhpDisabledFunctions.php 1.0 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\Settings\SetupChecks;
  8. use OCP\IL10N;
  9. use OCP\SetupCheck\ISetupCheck;
  10. use OCP\SetupCheck\SetupResult;
  11. class PhpDisabledFunctions implements ISetupCheck {
  12. public function __construct(
  13. private IL10N $l10n,
  14. ) {
  15. }
  16. public function getName(): string {
  17. return $this->l10n->t('PHP set_time_limit');
  18. }
  19. public function getCategory(): string {
  20. return 'php';
  21. }
  22. public function run(): SetupResult {
  23. if (function_exists('set_time_limit') && !str_contains(ini_get('disable_functions'), 'set_time_limit')) {
  24. return SetupResult::success($this->l10n->t('The function is available.'));
  25. } else {
  26. return SetupResult::warning(
  27. $this->l10n->t('The PHP function "set_time_limit" is not available. This could result in scripts being halted mid-execution, breaking your installation. Enabling this function is strongly recommended.'),
  28. );
  29. }
  30. }
  31. }