Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX] handle localizations with un-available tsfe more gracefully #3737

Conversation

adamkoppede
Copy link
Contributor

@adamkoppede adamkoppede commented Jul 27, 2023

Given the following scenario:

  • non-localized root page for multi-language site
  • below this root page is a localized folder
  • inside that localized folder are localized record to index

Since TypoScriptFrontendController is not initialized for sys_folder page records, it'll walk up to the parent page and try to initialize TypoScriptFrontendController for it. However, this isn't possible in the given scenario because the page isn't localized into all languages. Tsfe::getTsfeByPageIdAndLanguageId() returns null in this case, which triggers a NullPointerException when getLanguageOverlay() is called on it. When the NPE is thrown none of the localizations of the item will be indexed, even though some could have been successfully indexed.

This change checks aborts the operation when the specific TypoScriptFrontendController for the item is null, which causes queue items for which TypoScriptFrontendController could not be initialized to not get indexed.

How to test

  1. Have the following setup:
    • a site with multiple languages configured
    • the root page of that site is not localized for one of the languages
    • below the root page is a folder page record which localizations for all configured langauges
    • inside the folder page are database records for which an indexing configuration exists. They're also localized.
  2. index the database records (manually via index queue backend module works too)

I tested the change in TYPO3 11.5.30 and ext-solr 11.5.3

Copy link
Collaborator

@dkd-kaehm dkd-kaehm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tanks for this fix.

Given the following scenario:
- non-localized root page for multi-language site
- below this root page is a localized folder
- inside that localized folder are localized record to index

Since TypoScriptFrontendController is not initialized for sys_folder
page records, it'll walk up to the parent page and try to initialize
TypoScriptFrontendController for it. However, this isn't possible in
the given scenario because the page isn't localized into all languages.
Tsfe::getTsfeByPageIdAndLanguageId() returns null in this case, which
triggers a NullPointerException when getLanguageOverlay() is called on
it. When the NPE is thrown none of the localizations of the item will
be indexed, even though some could have been successfully indexed.

This change checks aborts the operation when the specific
TypoScriptFrontendController for the item is null, which causes queue
items for which TypoScriptFrontendController could not be initialized
to not get indexed.
@dkd-kaehm dkd-kaehm force-pushed the bugfix/handle_localizations_with_un-available_tsfe_more_gracefully branch from b86a0d0 to cce919e Compare October 13, 2023 15:11
dkd-kaehm pushed a commit to dkd-kaehm/ext-solr that referenced this pull request Oct 13, 2023
Given the following scenario:
- non-localized root page for multi-language site
- below this root page is a localized folder
- inside that localized folder are localized record to index

Since TypoScriptFrontendController is not initialized for sys_folder
page records, it'll walk up to the parent page and try to initialize
TypoScriptFrontendController for it. However, this isn't possible in
the given scenario because the page isn't localized into all languages.
Tsfe::getTsfeByPageIdAndLanguageId() returns null in this case, which
triggers a NullPointerException when getLanguageOverlay() is called on
it. When the NPE is thrown none of the localizations of the item will
be indexed, even though some could have been successfully indexed.

This change checks aborts the operation when the specific
TypoScriptFrontendController for the item is null, which causes queue
items for which TypoScriptFrontendController could not be initialized
to not get indexed.

Ports: TYPO3-Solr#3737
@dkd-kaehm dkd-kaehm merged commit bbdda0c into TYPO3-Solr:main Oct 13, 2023
8 checks passed
dkd-kaehm pushed a commit that referenced this pull request Oct 13, 2023
Given the following scenario:
- non-localized root page for multi-language site
- below this root page is a localized folder
- inside that localized folder are localized record to index

Since TypoScriptFrontendController is not initialized for sys_folder
page records, it'll walk up to the parent page and try to initialize
TypoScriptFrontendController for it. However, this isn't possible in
the given scenario because the page isn't localized into all languages.
Tsfe::getTsfeByPageIdAndLanguageId() returns null in this case, which
triggers a NullPointerException when getLanguageOverlay() is called on
it. When the NPE is thrown none of the localizations of the item will
be indexed, even though some could have been successfully indexed.

This change checks aborts the operation when the specific
TypoScriptFrontendController for the item is null, which causes queue
items for which TypoScriptFrontendController could not be initialized
to not get indexed.

Ports: #3737
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants