Breaking: #107654 - Remove random subpage option of doktype=shortcut
See forge#107654
Description
The random subpage option for shortcut pages has been removed from TYPO3 Core.
This option allowed shortcut pages to redirect to a random subpage, which was problematic for caching and resulted in unpredictable behavior - a "random" page was not truly random, as the page linking to this shortcut was cached.
The following changes have been made:
- The class constant
\TYPO3\has been removed.CMS\ Core\ Domain\ Repository\ Page Repository:: SHORTCUT_ MODE_ RANDOM_ SUBPAGE - The method signature of
\TYPO3\has changed fromCMS\ Core\ Domain\ Repository\ Page Repository:: resolve Shortcut Page () resolvetoShortcut Page (array $page, bool $resolve Random Subpages = false, bool $disable Group Access Check = false) resolve.Shortcut Page (array $page, bool $disable Group Access Check = false) - The TCA configuration for
pages.no longer includes the option Random subpage of selected/current page.shortcut_ mode
Impact
Code using the removed constant
\TYPO3\
will fail with a PHP fatal error.
Code calling
Page with three parameters,
where the second parameter was
$resolve, will fail. The
second parameter is now
$disable.
Shortcut pages configured to use random subpage mode will now behave as if they were configured for first subpage mode.
Affected installations
TYPO3 installations with:
- Extensions using the constant
PageRepository:: SHORTCUT_ MODE_ RANDOM_ SUBPAGE - Extensions calling
Pagewith theRepository:: resolve Shortcut Page () $resolveparameterRandom Subpages - Extensions extending
Pageand overridingRepository getPage Shortcut () - Shortcut pages configured with random subpage mode in the database
Migration
Remove any usage of
Page.
Update calls to
Page to remove the
$resolve parameter:
use TYPO3\CMS\Core\Domain\Repository\PageRepository;
$pageRepository = GeneralUtility::makeInstance(PageRepository::class);
$page = $pageRepository->resolveShortcutPage($page, false, true);
use TYPO3\CMS\Core\Domain\Repository\PageRepository;
$pageRepository = GeneralUtility::makeInstance(PageRepository::class);
$page = $pageRepository->resolveShortcutPage($page, true);
For shortcut pages configured with random subpage mode, update the database records to use a different shortcut mode (for example, first subpage or a specific target page):
UPDATE pages
SET shortcut_mode = 1
WHERE shortcut_mode = 2;