| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- <?php
- namespace Opentalent\OtAdmin\Controller;
- use Opentalent\OtAdmin\Domain\Entity\ScanReport;
- use Opentalent\OtCore\Controller\ActionController;
- use Opentalent\OtCore\Domain\Repository\OrganizationRepository;
- use TYPO3\CMS\Core\Utility\GeneralUtility;
- use TYPO3\CMS\Extbase\Object\ObjectManager;
- /**
- * ScanController scan the Typo3 DB to find potential issues
- */
- class ScanController extends ActionController
- {
- /**
- * Perform a full scan of the Typo3 DB, and confront it to the
- * Opentalent organizations list.
- *
- * @param bool $fullScan If true, a 'warnings' entry will be added to the result of each site status,
- * and a full scan of the website pages will be performed.
- * @return ScanReport
- */
- public function scanAllAction(bool $fullScan = false): ScanReport
- {
- $organizationRepository = GeneralUtility::makeInstance(ObjectManager::class)->get(OrganizationRepository::class);
- $siteController = GeneralUtility::makeInstance(ObjectManager::class)->get(SiteController::class);
- $report = new ScanReport();
- $organizationsCollection = $organizationRepository->getAll();
- foreach ($organizationsCollection->getMembers() as $organization) {
- $status = $siteController->getSiteStatusAction($organization->getId(), $fullScan);
- $report->setResultFor($organization->getId(), $status);
- }
- return $report;
- }
- }
|