ScanController.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace Opentalent\OtAdmin\Controller;
  3. use Opentalent\OtCore\Controller\ActionController;
  4. use Opentalent\OtCore\Domain\Repository\OrganizationRepository;
  5. use TYPO3\CMS\Core\Utility\GeneralUtility;
  6. use TYPO3\CMS\Extbase\Object\ObjectManager;
  7. /**
  8. * The ScanController allows to scan the Typo3 DB to find potential issues
  9. */
  10. class ScanController extends ActionController
  11. {
  12. /**
  13. * Perform a full scan of the Typo3 DB, and confront it to the
  14. * Opentalent organizations list.
  15. *
  16. * @param bool $fullScan If true, a 'warnings' entry will be added to the result of each site status,
  17. * and a full scan of the website pages will be performed.
  18. * @return array
  19. */
  20. public function scanAllAction(bool $fullScan = false): array
  21. {
  22. $organizationRepository = GeneralUtility::makeInstance(ObjectManager::class)->get(OrganizationRepository::class);
  23. $siteController = GeneralUtility::makeInstance(ObjectManager::class)->get(SiteController::class);
  24. $results = [];
  25. $organizationsCollection = $organizationRepository->getAll();
  26. foreach ($organizationsCollection->getMembers() as $organization) {
  27. $status = $siteController->getSiteStatusAction($organization->getId(), $fullScan);
  28. $results[$organization->getId()] = $status;
  29. }
  30. return $results;
  31. }
  32. }