feat: clear cache of travel info page after dates import

This commit is contained in:
Björn Fromme
2024-10-30 10:59:59 +01:00
parent 5de929aa55
commit ebc29e8e09
4 changed files with 25 additions and 7 deletions
@@ -84,7 +84,8 @@ class DateCommandController extends Command
$output->writeln(sprintf('%d rows imported.', $count )); $output->writeln(sprintf('%d rows imported.', $count ));
$settings = $this->getSettings(); $settings = $this->getSettings();
$resellerPageUid = $settings['resellerExportPageUid']; $resellerPageUid = $settings['resellerExportPageUid'];
$this->cacheService->clearPageCache($resellerPageUid); $travelInfoPageUid = $settings['travelInfoPageUid'];
$this->cacheService->clearPageCache([$resellerPageUid, $travelInfoPageUid]);
return 0; return 0;
} }
@@ -29,22 +29,36 @@ namespace EP\EpProducts\Task;
use EP\EpProducts\Service\DateImportService; use EP\EpProducts\Service\DateImportService;
use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Object\ObjectManager; use TYPO3\CMS\Extbase\Configuration\ConfigurationManager;
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
use TYPO3\CMS\Extbase\Service\CacheService;
use TYPO3\CMS\Scheduler\Task\AbstractTask; use TYPO3\CMS\Scheduler\Task\AbstractTask;
class ImportDatesTask extends AbstractTask class ImportDatesTask extends AbstractTask
{ {
public function execute() public function execute(): bool
{ {
/** @var \TYPO3\CMS\Extbase\Object\ObjectManager $objectManager */ $importService = GeneralUtility::makeInstance(DateImportService::class);
$objectManager = GeneralUtility::makeInstance(ObjectManager::class); $cacheService = GeneralUtility::makeInstance(CacheService::class);
/** @var \EP\EpProducts\Service\DateImportService $importService */
$importService = $objectManager->get(DateImportService::class);
if ($importService->isImportRequired()) { if ($importService->isImportRequired()) {
$path = GeneralUtility::getFileAbsFileName('fileadmin/xmlexport'); $path = GeneralUtility::getFileAbsFileName('fileadmin/xmlexport');
$importService->import($path); $importService->import($path);
} }
$settings = $this->getSettings();
$travelInfoPageUid = $settings['travelInfoPageUid'];
$cacheService->clearPageCache($travelInfoPageUid);
return true; return true;
} }
protected function getSettings(): array
{
$configurationManager = GeneralUtility::makeInstance(ConfigurationManager::class);
$settings = $configurationManager
->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
return $settings['plugin.']['tx_epproducts.']['settings.'];
}
} }
@@ -34,6 +34,8 @@ plugin.tx_epproducts {
defaultDetailPageUid = defaultDetailPageUid =
# cat=epproducts/110/120; type=string; label=Page UID with reseller export plugin # cat=epproducts/110/120; type=string; label=Page UID with reseller export plugin
resellerExportPageUid = resellerExportPageUid =
# cat=epproducts/110/130; type=string; label=Page UID with travel info plugin
travelInfoPageUid =
# cat=epproducts/120/100; type=string; label=Exclude products with concept UIDs from search result (CSV) # cat=epproducts/120/100; type=string; label=Exclude products with concept UIDs from search result (CSV)
excludedConceptUids = excludedConceptUids =
# cat=epproducts/120/110; type=string; label=Exclude regions with these UIDs from filter options (CSV) # cat=epproducts/120/110; type=string; label=Exclude regions with these UIDs from filter options (CSV)
@@ -38,6 +38,7 @@ plugin.tx_epproducts {
priceTableRoomTypes = {$plugin.tx_epproducts.settings.priceTableRoomTypes} priceTableRoomTypes = {$plugin.tx_epproducts.settings.priceTableRoomTypes}
searchLogIgnoreIps = {$plugin.tx_epproducts.settings.searchLogIgnoreIps} searchLogIgnoreIps = {$plugin.tx_epproducts.settings.searchLogIgnoreIps}
groupsPageUid = {$plugin.tx_eptheme.settings.groupsPageUid} groupsPageUid = {$plugin.tx_eptheme.settings.groupsPageUid}
travelInfoPageUid = {$plugin.tx_eptheme.settings.travelInfoPageUid}
groupsContactFormPageUid = {$plugin.tx_eptheme.settings.groupsContactFormPageUid} groupsContactFormPageUid = {$plugin.tx_eptheme.settings.groupsContactFormPageUid}
coronaUpdatesPageUid = {$plugin.tx_eptheme.settings.coronaUpdatesPageUid} coronaUpdatesPageUid = {$plugin.tx_eptheme.settings.coronaUpdatesPageUid}
googleMapsApiKey = {$plugin.tx_eptheme.settings.googleMapsApiKey} googleMapsApiKey = {$plugin.tx_eptheme.settings.googleMapsApiKey}