Skip to content

Commit

Permalink
[BUGFIX] Use latest slug in PopulatePageSlug
Browse files Browse the repository at this point in the history
PopulatePageSlug is an upgrade wizard which migrates existing slugs
from realurl tables to the table pages.slug.

In realurl, when the page title changed, the realurl slug changed
(if not fixed). Realurl handled this by adding temporary entries to
its tables which would be used to redirect the URL to its new location.
These entries had a fixed expiration date (expire > 0). The final
slug had no expiration date (expire = 0)

The previous behaviour in PopulatePageSlug preferred entries from
tx_realurl_pathdata with an expiration date (expire > 0) over
entries without (expire = 0). This would prefer (temporary) entries
that were only used for the redirects over the final slug.

This patch uses the 'uid' for sorting in descending order, which
will always use the latest entry for a specific page / language
combinations.

Resolves: #89194
Related: #89964
Releases: master, 9.5
Change-Id: Ica18bf5c6df9d101ccfce7712eae9c979e558a11
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/62942
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Frank Nägler <frank.naegler@typo3.org>
Reviewed-by: Frank Nägler <frank.naegler@typo3.org>
  • Loading branch information
sypets authored and NeoBlack committed Jan 17, 2020
1 parent f3b9c4b commit 8758e9e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion typo3/sysext/install/Classes/Updates/PopulatePageSlugs.php
Expand Up @@ -234,7 +234,7 @@ protected function getSuggestedSlugs(string $tableName): array
$queryBuilder->expr()->gt('expire', $queryBuilder->createNamedParameter($currentTimestamp))
)
)
->orderBy('expire', 'DESC')
->orderBy('uid', 'DESC')
->execute();
$suggestedSlugs = [];
while ($row = $statement->fetch()) {
Expand Down

0 comments on commit 8758e9e

Please sign in to comment.