From cc8e3cc330d06e031447b3163cd568d50dfb539d Mon Sep 17 00:00:00 2001 From: Christine Zoglmeier Date: Thu, 19 Dec 2024 13:51:47 +0100 Subject: [PATCH] [UPGRADE] Remove constants required for supporting TYPO3_11 and TYPO3_12 --- .../Backend/Button/ModuleShortcutButton.php | 20 ++--- .../ContextMenu/PublishItemProvider.php | 18 +--- .../FileEdgeCacheInvalidationService.php | 6 +- .../SystemInformationExportController.php | 8 +- .../Tests/SshConnection/SshConnectionTest.php | 5 -- Configuration/Services.php | 9 +- ext_tables.php | 82 ------------------- 7 files changed, 14 insertions(+), 134 deletions(-) diff --git a/Classes/Backend/Button/ModuleShortcutButton.php b/Classes/Backend/Button/ModuleShortcutButton.php index d4a8d01ca..b5ae6467f 100644 --- a/Classes/Backend/Button/ModuleShortcutButton.php +++ b/Classes/Backend/Button/ModuleShortcutButton.php @@ -38,8 +38,6 @@ use function ucfirst; -use const In2code\In2publishCore\TYPO3_V11; - class ModuleShortcutButton extends ShortcutButton { public function setRequest(ServerRequestInterface $request): void @@ -48,18 +46,12 @@ public function setRequest(ServerRequestInterface $request): void $route = $request->getAttribute('route'); $arguments = $request->getQueryParams(); $pageId = $request->getParsedBody()['id'] ?? $request->getQueryParams()['id'] ?? null; - - if (TYPO3_V11) { - $modConf = $route->getOption('moduleConfiguration'); - $displayName = LocalizationUtility::translate($modConf['labels'] . ':mlang_tabs_tab'); - } else { - /** - * @noinspection PhpUndefinedClassInspection - * @var ExtbaseModule $module - */ - $module = $route->getOption('module'); - $displayName = LocalizationUtility::translate($module->getTitle()); - } + /** + * @noinspection PhpUndefinedClassInspection + * @var ExtbaseModule $module + */ + $module = $route->getOption('module'); + $displayName = LocalizationUtility::translate($module->getTitle()); if (null !== $pageId) { if (0 === $pageId) { diff --git a/Classes/Features/ContextMenuPublishEntry/ContextMenu/PublishItemProvider.php b/Classes/Features/ContextMenuPublishEntry/ContextMenu/PublishItemProvider.php index 5870310ab..910c3e491 100644 --- a/Classes/Features/ContextMenuPublishEntry/ContextMenu/PublishItemProvider.php +++ b/Classes/Features/ContextMenuPublishEntry/ContextMenu/PublishItemProvider.php @@ -40,9 +40,6 @@ use function func_get_args; -use const In2code\In2publishCore\TYPO3_V11; -use const In2code\In2publishCore\TYPO3_V12; - class PublishItemProvider extends AbstractProvider { protected $itemsConfiguration = [ @@ -74,12 +71,9 @@ public function getPriority(): int public function addItems(array $items): array { - // In TYPO3 v12 item providers are registered automatically. The explicit config check is required. - if (TYPO3_V12) { - $configContainer = GeneralUtility::makeInstance(ConfigContainer::class); - if (!$configContainer->get('features.contextMenuPublishEntry.enable')) { - return $items; - } + $configContainer = GeneralUtility::makeInstance(ConfigContainer::class); + if (!$configContainer->get('features.contextMenuPublishEntry.enable')) { + return $items; } if (!$this->permissionService->isUserAllowedToPublish()) { return $items; @@ -105,11 +99,7 @@ protected function getAdditionalAttributes(string $itemName): array ['id' => $this->identifier], ); $attributes['data-publish-url'] = $publishUrl; - if (TYPO3_V11) { - $attributes['data-callback-module'] = 'TYPO3/CMS/In2publishCore/ContextMenuPublishEntry'; - } else { - $attributes['data-callback-module'] = '@in2code/in2publish_core/context-menu-actions'; - } + $attributes['data-callback-module'] = '@in2code/in2publish_core/context-menu-actions'; } return $attributes; } diff --git a/Classes/Features/FileEdgeCacheInvalidator/Domain/Service/FileEdgeCacheInvalidationService.php b/Classes/Features/FileEdgeCacheInvalidator/Domain/Service/FileEdgeCacheInvalidationService.php index 72aa488c0..b6361e180 100644 --- a/Classes/Features/FileEdgeCacheInvalidator/Domain/Service/FileEdgeCacheInvalidationService.php +++ b/Classes/Features/FileEdgeCacheInvalidator/Domain/Service/FileEdgeCacheInvalidationService.php @@ -38,8 +38,6 @@ use function array_key_exists; use function in_array; -use const In2code\In2publishCore\TYPO3_V11; - class FileEdgeCacheInvalidationService { use LocalDatabaseInjection; @@ -100,9 +98,7 @@ protected function selectSysFileReferenceRecords(array $uidList): Result $query->select('tablenames as table', 'uid_foreign as uid') ->from('sys_file_reference') ->where($query->expr()->in('uid_local', $uidList)); - if (TYPO3_V11) { - $query->andWhere($query->expr()->eq('table_local', '"sys_file"')); - } + return $query->executeQuery(); } diff --git a/Classes/Features/SystemInformationExport/Controller/SystemInformationExportController.php b/Classes/Features/SystemInformationExport/Controller/SystemInformationExportController.php index c75c3d0b9..0436a6cd1 100644 --- a/Classes/Features/SystemInformationExport/Controller/SystemInformationExportController.php +++ b/Classes/Features/SystemInformationExport/Controller/SystemInformationExportController.php @@ -52,7 +52,6 @@ use function strlen; use function time; -use const In2code\In2publishCore\TYPO3_V11; use const JSON_THROW_ON_ERROR; class SystemInformationExportController extends AbstractAdminToolsController @@ -132,12 +131,7 @@ public function sysInfoDownloadAction(): void public function sysInfoUploadAction(): ResponseInterface { try { - if (TYPO3_V11) { - /** @var array $file */ - $fileName = $this->request->getArgument('jsonFile')['tmp_name']; - } else { - $fileName = !empty($this->request->getUploadedFiles()['jsonFile']) ? $this->request->getUploadedFiles()['jsonFile']->getTemporaryFileName() : null; - } + $fileName = !empty($this->request->getUploadedFiles()['jsonFile']) ? $this->request->getUploadedFiles()['jsonFile']->getTemporaryFileName() : null; } catch (NoSuchArgumentException $e) { $this->addFlashMessage( LocalizationUtility::translate( diff --git a/Classes/Testing/Tests/SshConnection/SshConnectionTest.php b/Classes/Testing/Tests/SshConnection/SshConnectionTest.php index 498466276..d3a40e7aa 100644 --- a/Classes/Testing/Tests/SshConnection/SshConnectionTest.php +++ b/Classes/Testing/Tests/SshConnection/SshConnectionTest.php @@ -40,8 +40,6 @@ use function array_diff; use function preg_match; -use const In2code\In2publishCore\TYPO3_V11; - class SshConnectionTest implements TestCaseInterface { use ConfigContainerInjection; @@ -110,9 +108,6 @@ public function run(): TestResult 'typo3', 'index.php', ]; - if (TYPO3_V11) { - $requiredNames[] = 'typo3conf'; - } if (!empty(array_diff($requiredNames, $documentRootFiles))) { return new TestResult('ssh_connection.foreign_document_root_wrong', TestResult::ERROR); diff --git a/Configuration/Services.php b/Configuration/Services.php index 2163a4eb7..954a6c441 100644 --- a/Configuration/Services.php +++ b/Configuration/Services.php @@ -16,8 +16,6 @@ use TYPO3\CMS\Core\DependencyInjection\PublicServicePass; use TYPO3\CMS\Core\Utility\GeneralUtility; -use const In2code\In2publishCore\TYPO3_V11; - return static function (ContainerConfigurator $configurator, ContainerBuilder $builder): void { $configurator->import('Component/*/Services.php'); $configurator->import('Features/*/Services.php'); @@ -38,11 +36,8 @@ $pageTypeServiceDefinition->setShared(true); $pageTypeServiceDefinition->setPublic(true); - if (TYPO3_V11) { - $pageTypeServiceDefinition->setClass(LegacyPageTypeService::class); - } else { - $pageTypeServiceDefinition->setClass(PageTypeRegistryService::class); - } + $pageTypeServiceDefinition->setClass(PageTypeRegistryService::class); + $builder->setDefinition(PageTypeService::class, $pageTypeServiceDefinition); $builder->registerForAutoconfiguration(TestCaseInterface::class) diff --git a/ext_tables.php b/ext_tables.php index f64ba667a..0768023f4 100755 --- a/ext_tables.php +++ b/ext_tables.php @@ -38,8 +38,6 @@ use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Utility\ExtensionUtility; -use const In2code\In2publishCore\TYPO3_V11; - (static function (): void { /***************************************************** Guards *****************************************************/ if (!defined('TYPO3')) { @@ -70,86 +68,6 @@ return; } - if (TYPO3_V11) { - /** - * Deprecated registering of Backend Modules - * Register Backend Modules for TYPO3 v11 - * can be removed in TYPO3 v13 - */ - if ($configContainer->get('module.m1')) { - ExtensionUtility::registerModule( - 'in2publish_core', - 'web', - 'm1', - '', - [ - RecordController::class => 'index,detail,publishRecord,toggleFilterStatus', - ], - [ - 'access' => 'user,group', - 'iconIdentifier' => 'in2publish-core-overview-module', - 'labels' => 'LLL:EXT:in2publish_core/Resources/Private/Language/locallang_mod1.xlf', - ], - ); - } - if ($configContainer->get('module.m3')) { - ExtensionUtility::registerModule( - 'in2publish_core', - 'file', - 'm3', - '', - [ - FileController::class => 'index,publishFolder,publishFile,toggleFilterStatus', - ], - [ - 'access' => 'user,group', - 'iconIdentifier' => 'in2publish-core-file-module', - 'labels' => 'LLL:EXT:in2publish_core/Resources/Private/Language/locallang_mod3.xlf', - ], - ); - } - - if ($configContainer->get('module.m4')) { - $toolsRegistry = GeneralUtility::makeInstance(ToolsRegistry::class); - $controllerActions = $toolsRegistry->processDataForTypo3V11(); - if (!empty($controllerActions)) { - ExtensionUtility::registerModule( - 'in2publish_core', - 'tools', - 'm4', - '', - $controllerActions, - [ - 'access' => 'admin', - 'iconIdentifier' => 'in2publish-core-tools-module', - 'labels' => 'LLL:EXT:in2publish_core/Resources/Private/Language/locallang_mod4.xlf', - ], - ); - } - } - - /************************************************ Redirect Support ************************************************/ - if ( - $configContainer->get('features.redirectsSupport.enable') - && ExtensionManagementUtility::isLoaded('redirects') - ) { - ExtensionUtility::registerModule( - 'in2publish_core', - 'site', - 'm5', - 'after:redirects', - [ - RedirectController::class => 'list,publish,selectSite', - ], - [ - 'access' => 'user,group', - 'iconIdentifier' => 'in2publish-core-redirect-module', - 'labels' => 'LLL:EXT:in2publish_core/Resources/Private/Language/locallang_mod5.xlf', - ], - ); - } - } - /******************************************* Context Menu Publish Entry *******************************************/ if ($configContainer->get('features.contextMenuPublishEntry.enable')) { $GLOBALS['TYPO3_CONF_VARS']['BE']['ContextMenu']['ItemProviders'][1595598780] = PublishItemProvider::class;