Skip to content
Snippets Groups Projects
Commit 712c24bc authored by Riny van Tiggelen's avatar Riny van Tiggelen Committed by Benni Mack
Browse files

[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: default avatarRichard Haeser <richard@maxserv.com>
Reviewed-by: default avatarGuido Schmechel <guido.schmechel@brandung.de>
Reviewed-by: Daniel Siepmann's avatarDaniel Siepmann <coding@daniel-siepmann.de>
Reviewed-by: default avatarBenni Mack <benni@typo3.org>
Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: default avatarRichard Haeser <richard@maxserv.com>
Tested-by: default avatarBenni Mack <benni@typo3.org>
parent 86b9b4a2
Branches
Tags
No related merge requests found
......@@ -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()) {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment