From bc2a914b678d7bda32da9d558fb27a15b10dc422 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Wed, 21 Oct 2026 15:19:13 +0200 Subject: [PATCH] feat: ep:import-dates command on TYPO3 13 - Registered with #[AsCommand]; Configuration/Commands.php is no longer read - Storage page of the imported records from the extension configuration (importStoragePid, 11 as in all site templates): frontend TypoScript is not available on the CLI in TYPO3 13 - The reseller and travel info page cache flush is gone with those plugins; the import still clears the page cache Co-Authored-By: Claude Opus 5.5 --- config/system/settings.php | 1 + .../Classes/Command/DateCommandController.php | 36 ++----------------- .../Classes/Service/DateImportService.php | 25 ++++--------- .../ep_products/Configuration/Commands.php | 9 ----- packages/ep_products/ext_conf_template.txt | 3 ++ 5 files changed, 13 insertions(+), 61 deletions(-) delete mode 100644 packages/ep_products/Configuration/Commands.php diff --git a/config/system/settings.php b/config/system/settings.php index dbb4ed3..9ad7881 100644 --- a/config/system/settings.php +++ b/config/system/settings.php @@ -46,6 +46,7 @@ return [ 'contentFeedLanguages' => '0', 'contentFeedNewsDetailPages' => 'ep-reisen:1392', 'contentFeedSites' => 'ep-reisen,ser,ski-boarderweek,ski-wochenenden,snowzone', + 'importStoragePid' => '11', 'myEpApiBaseUrl' => '', 'myEpApiClientId' => '', 'myEpApiClientSecret' => '', diff --git a/packages/ep_products/Classes/Command/DateCommandController.php b/packages/ep_products/Classes/Command/DateCommandController.php index df483c1..b6dd1d4 100644 --- a/packages/ep_products/Classes/Command/DateCommandController.php +++ b/packages/ep_products/Classes/Command/DateCommandController.php @@ -29,12 +29,12 @@ namespace EP\EpProducts\Command; use EP\EpProducts\Service\DateImportService; use EP\EpProducts\Service\ProductImportSource; +use Symfony\Component\Console\Attribute\AsCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface; -use TYPO3\CMS\Extbase\Service\CacheService; +#[AsCommand(name: 'ep:import-dates', description: 'Imports travel dates, rooms and prices from the MyE&P product export')] class DateCommandController extends Command { @@ -43,16 +43,6 @@ class DateCommandController extends Command */ protected $dateImportService; - /** - * @var CacheService - */ - protected $cacheService; - - /** - * @var ConfigurationManagerInterface - */ - protected $configurationManager; - /** * @var ProductImportSource */ @@ -60,21 +50,15 @@ class DateCommandController extends Command /** * @param DateImportService $importService - * @param CacheService $cacheService - * @param ConfigurationManagerInterface $configurationManager * @param ProductImportSource $importSource */ public function __construct ( DateImportService $importService, - CacheService $cacheService, - ConfigurationManagerInterface $configurationManager, ProductImportSource $importSource ) { $this->dateImportService = $importService; - $this->cacheService = $cacheService; - $this->configurationManager = $configurationManager; $this->importSource = $importSource; parent::__construct(); @@ -95,25 +79,11 @@ class DateCommandController extends Command $count = $this->dateImportService->import($import->getRows()); $this->importSource->markImported($import); + // DateImportService::import() clears the page cache $output->writeln(sprintf('%d rows imported.', $count )); - $settings = $this->getSettings(); - $resellerPageUid = $settings['resellerExportPageUid']; - $travelInfoPageUid = $settings['travelInfoPageUid']; - $this->cacheService->clearPageCache([$resellerPageUid, $travelInfoPageUid]); return 0; } - /** - * @return array - */ - protected function getSettings(): array - { - $settings = $this - ->configurationManager - ->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT); - - return $settings['plugin.']['tx_epproducts.']['settings.']; - } } diff --git a/packages/ep_products/Classes/Service/DateImportService.php b/packages/ep_products/Classes/Service/DateImportService.php index 30d665d..c7912fb 100644 --- a/packages/ep_products/Classes/Service/DateImportService.php +++ b/packages/ep_products/Classes/Service/DateImportService.php @@ -32,9 +32,8 @@ use EP\EpProducts\Domain\Model\Room; use EP\EpProducts\Traits\DbConnectionTrait; use Psr\Log\LoggerAwareInterface; use Psr\Log\LoggerAwareTrait; +use TYPO3\CMS\Core\Configuration\ExtensionConfiguration; use TYPO3\CMS\Core\SingletonInterface; -use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface; use TYPO3\CMS\Extbase\Service\CacheService; class DateImportService implements SingletonInterface, LoggerAwareInterface @@ -86,11 +85,6 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface */ const SELECTION_GROUP_LABEL_PERSONNEL = 'Leistungen Personal'; - /** - * @var ConfigurationManagerInterface - */ - protected $configurationManager; - /** * @var int */ @@ -129,31 +123,24 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface ]; /** - * @param ConfigurationManagerInterface $configurationManager + * @param ExtensionConfiguration $extensionConfiguration * @param CacheService $cacheService * @param ProductImportSource $importSource * @param RoomTypeResolver $roomTypeResolver */ public function __construct( - ConfigurationManagerInterface $configurationManager, + ExtensionConfiguration $extensionConfiguration, CacheService $cacheService, ProductImportSource $importSource, RoomTypeResolver $roomTypeResolver ) { - $this->configurationManager = $configurationManager; $this->cacheService = $cacheService; $this->importSource = $importSource; $this->roomTypeResolver = $roomTypeResolver; - $settings = GeneralUtility::removeDotsFromTS( - $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT) - ); - - if (isset($settings['plugin']['tx_epproducts']['persistence']['storagePid'])) { - $this->pid = $settings['plugin']['tx_epproducts']['persistence']['storagePid']; - } elseif (isset($settings['module']['tx_epproducts']['persistence']['storagePid'])) { - $this->pid = $settings['module']['tx_epproducts']['persistence']['storagePid']; - } + // Extension configuration rather than TypoScript: the import runs on the CLI, where + // TYPO3 13 has no frontend TypoScript (plugin.tx_epproducts.persistence.storagePid) + $this->pid = (int)$extensionConfiguration->get('ep_products', 'importStoragePid'); } /** diff --git a/packages/ep_products/Configuration/Commands.php b/packages/ep_products/Configuration/Commands.php deleted file mode 100644 index 2057b1c..0000000 --- a/packages/ep_products/Configuration/Commands.php +++ /dev/null @@ -1,9 +0,0 @@ - [ - 'class' => DateCommandController::class, - ], -]; diff --git a/packages/ep_products/ext_conf_template.txt b/packages/ep_products/ext_conf_template.txt index 54d4506..59fdd85 100644 --- a/packages/ep_products/ext_conf_template.txt +++ b/packages/ep_products/ext_conf_template.txt @@ -57,3 +57,6 @@ contentFeedExcludedPages = 634 # cat=ContentFeed; type=string; label=News detail page per site for the chatbot content feed (identifier:pageUid, comma-separated) contentFeedNewsDetailPages = ep-reisen:1392 + +# cat=Import; type=int+; label=Storage page of the imported dates and rooms +importStoragePid = 11