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 <[email protected]>
This commit is contained in:
1 parent
5227da2381
commit
bc2a914b67
5 files changed
+13
-61
No files matched your search
@@ -46,6 +46,7 @@ return [
|
|||||||
'contentFeedLanguages' => '0',
|
'contentFeedLanguages' => '0',
|
||||||
'contentFeedNewsDetailPages' => 'ep-reisen:1392',
|
'contentFeedNewsDetailPages' => 'ep-reisen:1392',
|
||||||
'contentFeedSites' => 'ep-reisen,ser,ski-boarderweek,ski-wochenenden,snowzone',
|
'contentFeedSites' => 'ep-reisen,ser,ski-boarderweek,ski-wochenenden,snowzone',
|
||||||
|
'importStoragePid' => '11',
|
||||||
'myEpApiBaseUrl' => '',
|
'myEpApiBaseUrl' => '',
|
||||||
'myEpApiClientId' => '',
|
'myEpApiClientId' => '',
|
||||||
'myEpApiClientSecret' => '',
|
'myEpApiClientSecret' => '',
|
||||||
|
|||||||
@@ -29,12 +29,12 @@ namespace EP\EpProducts\Command;
|
|||||||
|
|
||||||
use EP\EpProducts\Service\DateImportService;
|
use EP\EpProducts\Service\DateImportService;
|
||||||
use EP\EpProducts\Service\ProductImportSource;
|
use EP\EpProducts\Service\ProductImportSource;
|
||||||
|
use Symfony\Component\Console\Attribute\AsCommand;
|
||||||
use Symfony\Component\Console\Command\Command;
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
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
|
class DateCommandController extends Command
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -43,16 +43,6 @@ class DateCommandController extends Command
|
|||||||
*/
|
*/
|
||||||
protected $dateImportService;
|
protected $dateImportService;
|
||||||
|
|
||||||
/**
|
|
||||||
* @var CacheService
|
|
||||||
*/
|
|
||||||
protected $cacheService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var ConfigurationManagerInterface
|
|
||||||
*/
|
|
||||||
protected $configurationManager;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var ProductImportSource
|
* @var ProductImportSource
|
||||||
*/
|
*/
|
||||||
@@ -60,21 +50,15 @@ class DateCommandController extends Command
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param DateImportService $importService
|
* @param DateImportService $importService
|
||||||
* @param CacheService $cacheService
|
|
||||||
* @param ConfigurationManagerInterface $configurationManager
|
|
||||||
* @param ProductImportSource $importSource
|
* @param ProductImportSource $importSource
|
||||||
*/
|
*/
|
||||||
public function __construct
|
public function __construct
|
||||||
(
|
(
|
||||||
DateImportService $importService,
|
DateImportService $importService,
|
||||||
CacheService $cacheService,
|
|
||||||
ConfigurationManagerInterface $configurationManager,
|
|
||||||
ProductImportSource $importSource
|
ProductImportSource $importSource
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
$this->dateImportService = $importService;
|
$this->dateImportService = $importService;
|
||||||
$this->cacheService = $cacheService;
|
|
||||||
$this->configurationManager = $configurationManager;
|
|
||||||
$this->importSource = $importSource;
|
$this->importSource = $importSource;
|
||||||
|
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
@@ -95,25 +79,11 @@ class DateCommandController extends Command
|
|||||||
|
|
||||||
$count = $this->dateImportService->import($import->getRows());
|
$count = $this->dateImportService->import($import->getRows());
|
||||||
$this->importSource->markImported($import);
|
$this->importSource->markImported($import);
|
||||||
|
// DateImportService::import() clears the page cache
|
||||||
$output->writeln(sprintf('%d rows imported.', $count ));
|
$output->writeln(sprintf('%d rows imported.', $count ));
|
||||||
$settings = $this->getSettings();
|
|
||||||
$resellerPageUid = $settings['resellerExportPageUid'];
|
|
||||||
$travelInfoPageUid = $settings['travelInfoPageUid'];
|
|
||||||
$this->cacheService->clearPageCache([$resellerPageUid, $travelInfoPageUid]);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
protected function getSettings(): array
|
|
||||||
{
|
|
||||||
$settings = $this
|
|
||||||
->configurationManager
|
|
||||||
->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
|
|
||||||
|
|
||||||
return $settings['plugin.']['tx_epproducts.']['settings.'];
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -32,9 +32,8 @@ use EP\EpProducts\Domain\Model\Room;
|
|||||||
use EP\EpProducts\Traits\DbConnectionTrait;
|
use EP\EpProducts\Traits\DbConnectionTrait;
|
||||||
use Psr\Log\LoggerAwareInterface;
|
use Psr\Log\LoggerAwareInterface;
|
||||||
use Psr\Log\LoggerAwareTrait;
|
use Psr\Log\LoggerAwareTrait;
|
||||||
|
use TYPO3\CMS\Core\Configuration\ExtensionConfiguration;
|
||||||
use TYPO3\CMS\Core\SingletonInterface;
|
use TYPO3\CMS\Core\SingletonInterface;
|
||||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
|
||||||
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
|
|
||||||
use TYPO3\CMS\Extbase\Service\CacheService;
|
use TYPO3\CMS\Extbase\Service\CacheService;
|
||||||
|
|
||||||
class DateImportService implements SingletonInterface, LoggerAwareInterface
|
class DateImportService implements SingletonInterface, LoggerAwareInterface
|
||||||
@@ -86,11 +85,6 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
|
|||||||
*/
|
*/
|
||||||
const SELECTION_GROUP_LABEL_PERSONNEL = 'Leistungen Personal';
|
const SELECTION_GROUP_LABEL_PERSONNEL = 'Leistungen Personal';
|
||||||
|
|
||||||
/**
|
|
||||||
* @var ConfigurationManagerInterface
|
|
||||||
*/
|
|
||||||
protected $configurationManager;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
@@ -129,31 +123,24 @@ class DateImportService implements SingletonInterface, LoggerAwareInterface
|
|||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param ConfigurationManagerInterface $configurationManager
|
* @param ExtensionConfiguration $extensionConfiguration
|
||||||
* @param CacheService $cacheService
|
* @param CacheService $cacheService
|
||||||
* @param ProductImportSource $importSource
|
* @param ProductImportSource $importSource
|
||||||
* @param RoomTypeResolver $roomTypeResolver
|
* @param RoomTypeResolver $roomTypeResolver
|
||||||
*/
|
*/
|
||||||
public function __construct(
|
public function __construct(
|
||||||
ConfigurationManagerInterface $configurationManager,
|
ExtensionConfiguration $extensionConfiguration,
|
||||||
CacheService $cacheService,
|
CacheService $cacheService,
|
||||||
ProductImportSource $importSource,
|
ProductImportSource $importSource,
|
||||||
RoomTypeResolver $roomTypeResolver
|
RoomTypeResolver $roomTypeResolver
|
||||||
) {
|
) {
|
||||||
$this->configurationManager = $configurationManager;
|
|
||||||
$this->cacheService = $cacheService;
|
$this->cacheService = $cacheService;
|
||||||
$this->importSource = $importSource;
|
$this->importSource = $importSource;
|
||||||
$this->roomTypeResolver = $roomTypeResolver;
|
$this->roomTypeResolver = $roomTypeResolver;
|
||||||
|
|
||||||
$settings = GeneralUtility::removeDotsFromTS(
|
// Extension configuration rather than TypoScript: the import runs on the CLI, where
|
||||||
$this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT)
|
// TYPO3 13 has no frontend TypoScript (plugin.tx_epproducts.persistence.storagePid)
|
||||||
);
|
$this->pid = (int)$extensionConfiguration->get('ep_products', 'importStoragePid');
|
||||||
|
|
||||||
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'];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use EP\EpProducts\Command\DateCommandController;
|
|
||||||
|
|
||||||
return [
|
|
||||||
'ep:import-dates' => [
|
|
||||||
'class' => DateCommandController::class,
|
|
||||||
],
|
|
||||||
];
|
|
||||||
@@ -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)
|
# cat=ContentFeed; type=string; label=News detail page per site for the chatbot content feed (identifier:pageUid, comma-separated)
|
||||||
contentFeedNewsDetailPages = ep-reisen:1392
|
contentFeedNewsDetailPages = ep-reisen:1392
|
||||||
|
|
||||||
|
# cat=Import; type=int+; label=Storage page of the imported dates and rooms
|
||||||
|
importStoragePid = 11
|
||||||
Reference in new issue
Block a user