diff --git a/Classes/Command/MigrateFieldsCommand.php b/Classes/Command/MigrateFieldsCommand.php index 9810657..3d545f3 100644 --- a/Classes/Command/MigrateFieldsCommand.php +++ b/Classes/Command/MigrateFieldsCommand.php @@ -46,28 +46,26 @@ protected function execute(InputInterface $input, OutputInterface $output): int if ($this->doesRealurlFieldExist($conn)) { $queryBuilder = $conn->createQueryBuilder(); $queryBuilder->getRestrictions()->removeAll(); - $existingRows = $queryBuilder + $existingPages = $queryBuilder ->select('uid') ->from('pages') ->where( $queryBuilder->expr()->eq('tx_realurl_exclude', $queryBuilder->createNamedParameter(1, Connection::PARAM_INT)) ) - ->execute() - ->fetchAll(); + ->executeQuery() + ->fetchFirstColumn(); - if (count($existingRows) === 0) { + if (count($existingPages) === 0) { $io->success('Nothing done, as there is no row to update.'); return 0; } - $existingPages = array_column($existingRows, 'uid'); - $updateQueryBuilder = $conn->createQueryBuilder(); $affectedRows = $updateQueryBuilder ->update('pages') ->set('exclude_slug_for_subpages', 1) ->where( - $queryBuilder->expr()->orX( + $queryBuilder->expr()->or( $queryBuilder->expr()->in( 'uid', // do not use named parameter here as the list can get too long @@ -79,7 +77,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int ) ) ) - ->execute(); + ->executeQuery(); $io->success('Migrated ' . $affectedRows . ' pages (incl. translations)'); } else { @@ -96,7 +94,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int */ protected function doesRealurlFieldExist(Connection $conn): bool { - $columns = $conn->getSchemaManager()->listTableColumns('pages'); + $columns = $conn->getSchemaInformation()->introspectTable('pages')->getColumns(); foreach ($columns as $column) { if (strtolower($column->getName()) === 'tx_realurl_exclude') { return true; diff --git a/Classes/SlugModifier.php b/Classes/SlugModifier.php index 65f5916..97e29e5 100644 --- a/Classes/SlugModifier.php +++ b/Classes/SlugModifier.php @@ -15,7 +15,6 @@ use TYPO3\CMS\Core\Database\Connection; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\DataHandling\SlugHelper; -use TYPO3\CMS\Core\Information\Typo3Version; use TYPO3\CMS\Core\TypoScript\TypoScriptService; use TYPO3\CMS\Core\Utility\GeneralUtility; @@ -81,17 +80,13 @@ protected function resolveHookParameters(array $configuration, string $tableName if (isset($record['uid'])) { // load full record from db (else: it is a new record) $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('pages'); - $stm = $queryBuilder->select('*') + $row = $queryBuilder->select('*') ->from('pages') ->where( $queryBuilder->expr()->eq('uid', $queryBuilder->createNamedParameter($record['uid'], Connection::PARAM_INT)) ) - ->execute(); - if ((GeneralUtility::makeInstance(Typo3Version::class))->getMajorVersion() === 10) { - $row = $stm->fetch(); - } else { - $row = $stm->fetchAssociative(); - } + ->executeQuery() + ->fetchAssociative(); if ($row !== false) { $this->recordData = array_replace($row, $record); } @@ -162,7 +157,7 @@ protected function regenerateSlug(SlugHelper $helper): string $slug = $prefix . $slug; } - return (string)$helper->sanitize($slug); + return $helper->sanitize($slug); } /** diff --git a/Classes/Updates/MigrateRealUrlExcludeField.php b/Classes/Updates/MigrateRealUrlExcludeField.php index be12a37..3ea5302 100644 --- a/Classes/Updates/MigrateRealUrlExcludeField.php +++ b/Classes/Updates/MigrateRealUrlExcludeField.php @@ -15,6 +15,7 @@ use TYPO3\CMS\Core\Database\Connection; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Utility\GeneralUtility; +use TYPO3\CMS\Install\Attribute\UpgradeWizard; use TYPO3\CMS\Install\Updates\DatabaseUpdatedPrerequisite; use TYPO3\CMS\Install\Updates\UpgradeWizardInterface; @@ -22,6 +23,7 @@ * Command for migrating fields from "pages.tx_realurl_exclude" * into "pages.exclude_slug_for_subpages". */ +#[UpgradeWizard('masiMigrateRealUrlExclude')] class MigrateRealUrlExcludeField implements UpgradeWizardInterface { public function getIdentifier(): string @@ -44,7 +46,7 @@ protected function getExistingExcludedPages(): array $conn = GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable('pages'); $queryBuilder = $conn->createQueryBuilder(); $queryBuilder->getRestrictions()->removeAll(); - $existingRows = $queryBuilder + $excludedPages = $queryBuilder ->select('uid') ->from('pages') ->where( @@ -53,11 +55,10 @@ protected function getExistingExcludedPages(): array $queryBuilder->createNamedParameter(1, Connection::PARAM_INT) ) ) - ->execute() - ->fetchAll(); + ->executeQuery() + ->fetchFirstColumn(); - return array_column($existingRows, 'uid'); - + return $excludedPages; } public function executeUpdate(): bool @@ -82,7 +83,7 @@ public function executeUpdate(): bool array_merge($existingPages, [0]) ) ) - ->execute(); + ->executeQuery(); return true; } @@ -90,7 +91,7 @@ public function executeUpdate(): bool protected function doesRealurlFieldExist(): bool { $conn = GeneralUtility::makeInstance(ConnectionPool::class)->getConnectionForTable('pages'); - $columns = $conn->getSchemaManager()->listTableColumns('pages'); + $columns = $conn->getSchemaInformation()->introspectTable('pages')->getColumns(); foreach ($columns as $column) { if (strtolower($column->getName()) === 'tx_realurl_exclude') { return true; diff --git a/composer.json b/composer.json index a60005f..01f9abf 100644 --- a/composer.json +++ b/composer.json @@ -13,8 +13,8 @@ "homepage": "https://github.com/b13/masi", "license": ["GPL-2.0-or-later"], "require": { - "php": "^7.4 || ~8.0", - "typo3/cms-core": "^10.4 || ^11.5 || ^12.0" + "php": "^8.1", + "typo3/cms-core": "^12.4 || ^13.0" }, "replace": { "typo3-ter/masi": "self.version" diff --git a/ext_emconf.php b/ext_emconf.php index 7ba9450..ec9ef4d 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -11,7 +11,7 @@ 'version' => '2.0.3', 'constraints' => [ 'depends' => [ - 'typo3' => '10.4.0-12.99.99', + 'typo3' => '12.4.0-13.4.99', ], ], ]; diff --git a/ext_localconf.php b/ext_localconf.php deleted file mode 100644 index 08005cb..0000000 --- a/ext_localconf.php +++ /dev/null @@ -1,9 +0,0 @@ -