Skip to content

[BUG] MountPagesUpdater throws an exception if indexing is disabled #4337

@dmitryd

Description

@dmitryd

Describe the bug

If indexing is disabled for the mount page, the attempt to fetch solr site in ApacheSolrForTypo3\Solr\Domain\Index\Queue\RecordMonitor\Helper::addPageToMountingSiteIndexQueue will return null and there will be an exception. A check is missing there.

Code is at https://github.com/TYPO3-Solr/ext-solr/blob/main/Classes/Domain/Index/Queue/RecordMonitor/Helper/MountPagesUpdater.php#L87

    protected function addPageToMountingSiteIndexQueue(int $mountedPageId, array $mountProperties): void
    {
        $siteRepository = GeneralUtility::makeInstance(SiteRepository::class);
        $mountingSite = $siteRepository->getSiteByPageId($mountProperties['mountPageDestination']);

        /** @var Page $pageInitializer */
        $pageInitializer = GeneralUtility::makeInstance(Page::class);
        $pageInitializer->setSite($mountingSite);

Here $mountingSite will be null and it is correct if indexing is disabled for the mount point, but setSite` expects a valis site.

To Reproduce
Steps to reproduce the behavior:

  1. Create a new root page, which is a mount point to the existing root page.
  2. Disable indexing via solr_enabled_read: false in the site config for that new site
  3. Edit any page in the site -> exception

Used versions (please complete the following information):

  • TYPO3 Version: 12.4.28
  • EXT:solr Version: 12.0.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions