|
70 | 70 | use OCP\IURLGenerator; |
71 | 71 | use OCP\Lock\ILockingProvider; |
72 | 72 | use OCP\Security\ISecureRandom; |
| 73 | +use OCP\Settings\SetupChecks\ISetupCheck; |
| 74 | +use Psr\Container\ContainerExceptionInterface; |
73 | 75 | use Symfony\Component\EventDispatcher\EventDispatcherInterface; |
74 | 76 | use Symfony\Component\EventDispatcher\GenericEvent; |
75 | 77 |
|
@@ -688,9 +690,12 @@ protected function isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed(): bool { |
688 | 690 | * @return DataResponse |
689 | 691 | */ |
690 | 692 | public function check() { |
691 | | - $phpDefaultCharset = new PhpDefaultCharset(); |
692 | | - $phpOutputBuffering = new PhpOutputBuffering(); |
693 | | - $legacySSEKeyFormat = new LegacySSEKeyFormat($this->l10n, $this->config, $this->urlGenerator); |
| 693 | + $newChecks = $this->runSetupChecks([ |
| 694 | + PhpDefaultCharset::class, |
| 695 | + PhpOutputBuffering::class, |
| 696 | + LegacySSEKeyFormat::class |
| 697 | + ]); |
| 698 | + |
694 | 699 | return new DataResponse( |
695 | 700 | [ |
696 | 701 | 'isGetenvServerWorking' => !empty(getenv('PATH')), |
@@ -731,10 +736,30 @@ public function check() { |
731 | 736 | 'isMysqlUsedWithoutUTF8MB4' => $this->isMysqlUsedWithoutUTF8MB4(), |
732 | 737 | 'isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed' => $this->isEnoughTempSpaceAvailableIfS3PrimaryStorageIsUsed(), |
733 | 738 | 'reverseProxyGeneratedURL' => $this->urlGenerator->getAbsoluteURL('index.php'), |
734 | | - PhpDefaultCharset::class => ['pass' => $phpDefaultCharset->run(), 'description' => $phpDefaultCharset->description(), 'severity' => $phpDefaultCharset->severity()], |
735 | | - PhpOutputBuffering::class => ['pass' => $phpOutputBuffering->run(), 'description' => $phpOutputBuffering->description(), 'severity' => $phpOutputBuffering->severity()], |
736 | | - LegacySSEKeyFormat::class => ['pass' => $legacySSEKeyFormat->run(), 'description' => $legacySSEKeyFormat->description(), 'severity' => $legacySSEKeyFormat->severity(), 'linkToDocumentation' => $legacySSEKeyFormat->linkToDocumentation()], |
737 | | - ] |
| 739 | + ] + $newChecks |
738 | 740 | ); |
739 | 741 | } |
| 742 | + |
| 743 | + protected function runSetupChecks(array $checks): array { |
| 744 | + $result = []; |
| 745 | + |
| 746 | + foreach ($checks as $check) { |
| 747 | + try { |
| 748 | + /** @var ISetupCheck $instance */ |
| 749 | + $instance = \OC::$server->get($check); |
| 750 | + } catch (ContainerExceptionInterface $e) { |
| 751 | + $this->logger->logException($e); |
| 752 | + continue; |
| 753 | + } |
| 754 | + |
| 755 | + $result[$check] = [ |
| 756 | + 'pass' => $instance->passes(), |
| 757 | + 'description' => $instance->description(), |
| 758 | + 'severity' => $instance->severity(), |
| 759 | + 'linkToDocumentation' => $instance->linkToDocumentation(), |
| 760 | + ]; |
| 761 | + } |
| 762 | + |
| 763 | + return $result; |
| 764 | + } |
740 | 765 | } |
0 commit comments