• Stefan Bürk's avatar
    [BUGFIX] Verify early for valid auto redirect creation or slug update · 5d94b732
    Stefan Bürk authored
    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
    Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/77535
    Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
    Tested-by: Stefan Bürk's avatarStefan Bürk <stefan@buerk.tech>
    Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
    Reviewed-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>
    Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
    Reviewed-by: Stefan Bürk's avatarStefan Bürk <stefan@buerk.tech>
    Tested-by: Oliver Bartsch's avatarOliver Bartsch <bo@cedev.de>