1
0

PhpOutdated.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2022 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 PhpOutdated implements ISetupCheck {
  12. public function __construct(
  13. private IL10N $l10n,
  14. ) {
  15. }
  16. public function getCategory(): string {
  17. return 'security';
  18. }
  19. public function getName(): string {
  20. return $this->l10n->t('PHP version');
  21. }
  22. public function run(): SetupResult {
  23. if (PHP_VERSION_ID < 80200) {
  24. return SetupResult::warning($this->l10n->t('You are currently running PHP %s. PHP 8.1 is now deprecated in Nextcloud 30. Nextcloud 31 may require at least PHP 8.2. Please upgrade to one of the officially supported PHP versions provided by the PHP Group as soon as possible.', [PHP_VERSION]), 'https://secure.php.net/supported-versions.php');
  25. }
  26. return SetupResult::success($this->l10n->t('You are currently running PHP %s.', [PHP_VERSION]));
  27. }
  28. }