SystemIs64bit.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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\IURLGenerator;
  10. use OCP\SetupCheck\ISetupCheck;
  11. use OCP\SetupCheck\SetupResult;
  12. class SystemIs64bit implements ISetupCheck {
  13. public function __construct(
  14. private IL10N $l10n,
  15. private IURLGenerator $urlGenerator,
  16. ) {
  17. }
  18. public function getName(): string {
  19. return $this->l10n->t('Architecture');
  20. }
  21. public function getCategory(): string {
  22. return 'system';
  23. }
  24. protected function is64bit(): bool {
  25. if (PHP_INT_SIZE < 8) {
  26. return false;
  27. } else {
  28. return true;
  29. }
  30. }
  31. public function run(): SetupResult {
  32. if ($this->is64bit()) {
  33. return SetupResult::success($this->l10n->t('64-bit'));
  34. } else {
  35. return SetupResult::warning(
  36. $this->l10n->t('It seems like you are running a 32-bit PHP version. Nextcloud needs 64-bit to run well. Please upgrade your OS and PHP to 64-bit!'),
  37. $this->urlGenerator->linkToDocs('admin-system-requirements')
  38. );
  39. }
  40. }
  41. }