From 712c24bc025ea0270ebfb220bc7152a36974fbf6 Mon Sep 17 00:00:00 2001 From: Riny van Tiggelen <info@online-gamer.nl> Date: Mon, 6 Apr 2020 10:57:30 +0200 Subject: [PATCH] [BUGFIX] Fixed order-by while querying old realurl table for slugs The old tx_realurl_pathcache does not have a uid field, but uses the field cache_id. The order-by now uses a different field depending on the table. Resolves: #90957 Releases: master, 9.5 Change-Id: I5efc62cb8a7cc1d96a503043d268fdacb3564e4b Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/64085 Reviewed-by: Richard Haeser <richard@maxserv.com> Reviewed-by: Guido Schmechel <guido.schmechel@brandung.de> Reviewed-by: Daniel Siepmann <coding@daniel-siepmann.de> Reviewed-by: Benni Mack <benni@typo3.org> Tested-by: TYPO3com <noreply@typo3.com> Tested-by: Richard Haeser <richard@maxserv.com> Tested-by: Benni Mack <benni@typo3.org> --- typo3/sysext/install/Classes/Updates/PopulatePageSlugs.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/typo3/sysext/install/Classes/Updates/PopulatePageSlugs.php b/typo3/sysext/install/Classes/Updates/PopulatePageSlugs.php index c216c19acce2..48c38b0136aa 100644 --- a/typo3/sysext/install/Classes/Updates/PopulatePageSlugs.php +++ b/typo3/sysext/install/Classes/Updates/PopulatePageSlugs.php @@ -138,7 +138,7 @@ class PopulatePageSlugs implements UpgradeWizardInterface if ($this->checkIfTableExists('tx_realurl_pathdata')) { $suggestedSlugs = $this->getSuggestedSlugs('tx_realurl_pathdata'); } elseif ($this->checkIfTableExists('tx_realurl_pathcache')) { - $suggestedSlugs = $this->getSuggestedSlugs('tx_realurl_pathcache'); + $suggestedSlugs = $this->getSuggestedSlugs('tx_realurl_pathcache', 'cache_id'); } $fieldConfig = $GLOBALS['TCA'][$this->table]['columns'][$this->fieldName]['config']; @@ -223,9 +223,10 @@ class PopulatePageSlugs implements UpgradeWizardInterface * Resolve prepared realurl "pagepath" for pages * * @param string $tableName + * @param string $identityField * @return array with pageID (default language) and language ID as two-dimensional array containing the page path */ - protected function getSuggestedSlugs(string $tableName): array + protected function getSuggestedSlugs(string $tableName, string $identityField = 'uid'): array { $context = GeneralUtility::makeInstance(Context::class); $currentTimestamp = $context->getPropertyFromAspect('date', 'timestamp'); @@ -241,7 +242,7 @@ class PopulatePageSlugs implements UpgradeWizardInterface $queryBuilder->expr()->gt('expire', $queryBuilder->createNamedParameter($currentTimestamp)) ) ) - ->orderBy('uid', 'DESC') + ->orderBy($identityField, 'DESC') ->execute(); $suggestedSlugs = []; while ($row = $statement->fetch()) { -- GitLab