PhpOutputBuffering.php 865 B

12345678910111213141516171819202122232425262728293031323334353637
  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 PhpOutputBuffering implements ISetupCheck {
  12. public function __construct(
  13. private IL10N $l10n,
  14. ) {
  15. }
  16. public function getCategory(): string {
  17. return 'php';
  18. }
  19. public function getName(): string {
  20. return $this->l10n->t('PHP "output_buffering" option');
  21. }
  22. public function run(): SetupResult {
  23. $value = trim(ini_get('output_buffering'));
  24. if ($value === '' || $value === '0') {
  25. return SetupResult::success($this->l10n->t('Disabled'));
  26. } else {
  27. return SetupResult::error($this->l10n->t('PHP configuration option "output_buffering" must be disabled'));
  28. }
  29. }
  30. }