Skip to main content

[FEATURE] Introduce SlugRedirectChangeItemCreatedEvent

A new PSR-14 based event "SlugRedirectChangeItemCreatedEvent"
is introduced, allowing extension authors to create additional
redirects for a changed page slug or to remove redirect source
candidates. This is especially useful to ensure creation of
related redirects. This can be used to create redirects for
special page types or sources build by fully respecting
configured route enhancers and decorators.

Custom source implementation must be provided based on already
available `RedirectSourceInterface`. Further events in later
steps of the process with dedicated follow-up changes will
reveal the full-power, which has been kicked-off with the
streamlining of #99188 and this change.

Current behaviour of creating redirects only based on the raw
slug value are kept by implementing a specific EventListener
for it. Extensions can replace the plain slug replacment source
by registering their listeners after the core listener.

TYPO3 core may implement and ship an additional source listener
for building source uri using the page router for page type "0",
therefore repspecting configured enhancers and decorators in a
dedicated patch.

Resolves: #99746
Related: #99188
Releases: main
Change-Id: I84356d00eda48d04d5bb35d90dc1fa3141698c75
Tested-by: core-ci <>
Reviewed-by: Stefan Bürk <>
Reviewed-by: Oliver Bartsch <>
Tested-by: Stefan Bürk <>
Tested-by: Benni Mack <>
Reviewed-by: Benni Mack <>
Tested-by: Oliver Bartsch <>

[BUGFIX] Verify early for valid auto redirect creation or slug update

Automatically creating redirects on page slug changes and/or
updating children page slugs is bound to a SiteConfiguration.
This means that only pages which has a proper SiteConfiguration
up in the rootline and the corresponding configuration options
set should lead to processing them.

In the past this has been checked and handled late in the service
class `TYPO3\CMS\Redirects\Service\SlugService`. These checks are
still there for proper workflow determination.

With #99188 the `ext:redirects` auto create workflow has been
streamlined as a preparatin for upcoming features and events,
which introduced the `SlugRedirectChangeItem` as a modern data
transport container. This item is created by a corresponding
factory, which als determined and set the corresponding Site
and SiteLanguage object to the change item.

If no site configuration can be found, a `SiteNotFoundException`
is thrown and not properly handled. Some instances may use
`SysFolder` beneath root point (pid === 0) with subpages without
a proper site configuration created on the `SysFolder`. Through
the streamlining in #99188 this is not properly covered and the
`SiteNotFoundException` not properly handled.

This change catches the `SiteNotFoundException` in the factory
service and additionally verify the configuration options early
if a change should be handled or not. If no handling needed or
no SiteConfiguration found, the factory now returns null instead
of a `SlugRedirectChangeItem`.

Resolves: #99675
Related: #99188
Releases: main
Change-Id: Icc147e7c5bad70969956a66252d6e1ac18d51cff
Tested-by: core-ci <>
Tested-by: Stefan Bürk <>
Tested-by: Christian Kuhn <>
Reviewed-by: Oliver Bartsch <>
Reviewed-by: Christian Kuhn <>
Reviewed-by: Stefan Bürk <>
Tested-by: Oliver Bartsch <>

[BUGFIX] Use correct record data in ext:redirect datahandler hook

ext:redirects provides the feature to eventually update subpage
slugs and automatically create redirects for changed pages. To
accomplish that, a combination of two DataHandler hooks are used
along with a centralized service. The service is used before the
page slug change is persistent to the database. Hook execution
for subpage changes are disabled, to contain all changes in one
correlation for eventually reverting.

With #99188 the auto-create chain has been streamlined to prepare
for further changes. However, added functional tests do not reflect
the real procedure properly. Because of that it has been overlooked
that the direct slug change which triggers is handled by the hook
works with old record, thus creating invalid page slug updates and
redirects for the children pages.

This change now properly combine the update data with the current
record data instead of retrieving not-yet updated data from the
database. Corresponding functional tests are adopted to update
the records after calling the hook implementation, which reflects
real procedure order.

Resolves: #99506
Related: #99188
Releases: main
Change-Id: Ib2fac341483b863ee20c228dfb6c8a06ea1978f9
Tested-by: core-ci <>
Tested-by: Stefan Froemken <>
Tested-by: Stefan Bürk <>
Tested-by: Christian Kuhn <>
Reviewed-by: Christian Kuhn <>
Reviewed-by: Stefan Froemken <>
Reviewed-by: Stefan Bürk <>