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

[BUG] 12.0.0-beta-1 : indexPage and incorrect fe_groups on access protected instance #3735

Closed
Tracked by #3376
Apen opened this issue Jul 26, 2023 · 1 comment · Fixed by #3811
Closed
Tracked by #3376

[BUG] 12.0.0-beta-1 : indexPage and incorrect fe_groups on access protected instance #3735

Apen opened this issue Jul 26, 2023 · 1 comment · Fixed by #3811
Assignees

Comments

@Apen
Copy link

Apen commented Jul 26, 2023

Describe the bug
The new version 12.0.0-beta-1 on last TYPO3 v12 doesnt get the correct fe_groups on frontend indexation. After a long debug session i notice a bug with 'solr.pageIndexingInstructions' & FrontendGroupsModifier .

This is a side effect of the Middleware order and the new attriibute 'solr.pageIndexingInstructions'.

TYPO3\CMS\Frontend\Middleware\FrontendUserAuthenticator is processed before ApacheSolrForTypo3\Solr\Middleware\PageIndexerInitialization.

So in \ApacheSolrForTypo3\Solr\EventListener\PageIndexer\FrontendGroupsModifier we will never have 'solr.pageIndexingInstructions' and we doesnt populate the correct fe_groups on a protected instance. So all the pages wil never be indexer and we only have the generic error message during indexing.

A smal test to validate that in FrontendGroupsModifier ;

public function __invoke(ModifyResolvedFrontendGroupsEvent $event): void
{
    $pageIndexerRequest = $event->getRequest()->getAttribute('solr.pageIndexingInstructions');

    // small test
    if ($event->getRequest()->hasHeader(PageIndexerRequest::SOLR_INDEX_HEADER)) {
        $jsonEncodedParameters = $event->getRequest()->getHeader(PageIndexerRequest::SOLR_INDEX_HEADER)[0];
        $pageIndexerRequest = GeneralUtility::makeInstance(PageIndexerRequest::class, $jsonEncodedParameters);
    }

    if (!$pageIndexerRequest instanceof PageIndexerRequest) {
        return;
    }
...

I force the $pageIndexerRequest to be regenerated, and all is working now :-)
This is not the correct solution, it is simply validate the bug.

Maybe fire the middleware before "typo3/cms-frontend/authentication" is the solution?
I let you choose that.

@Apen Apen changed the title [BUG] 12.0.0-beta-1 : indexPage and incorrect fe_groups [BUG] 12.0.0-beta-1 : indexPage and incorrect fe_groups on access protected instance Jul 26, 2023
@dkd-kaehm
Copy link
Collaborator

Related change set:

dkd-friedrich added a commit to dkd-friedrich/ext-solr that referenced this issue Oct 6, 2023
Fixes indexing of access protected pages and/or page contents.

Resolves: TYPO3-Solr#3735
dkd-friedrich added a commit to dkd-friedrich/ext-solr that referenced this issue Oct 6, 2023
Cleans and optimizes the frontend helper "PageIndexer" integration
test.

Failure test for non existing pages/sites is refactored and
PageIndexer adapted, even if AfterCacheableContentIsGeneratedEvent
is not dispatched e.g. as the page is not found, the response will
always contain the pageIndexed flag.

Additionally the methods of PageIndexer that were defined as public
to simplify testing are now protected, the tests are adapted
accordingly. If you have used this methods, you have to adapt your
code. Affected methods:
- setupConfiguration
- index
- indexPage

Relates: TYPO3-Solr#3735
dkd-kaehm pushed a commit to dkd-friedrich/ext-solr that referenced this issue Oct 10, 2023
Fixes indexing of access protected pages and/or page contents.

Resolves: TYPO3-Solr#3735
dkd-kaehm pushed a commit to dkd-friedrich/ext-solr that referenced this issue Oct 10, 2023
Cleans and optimizes the frontend helper "PageIndexer" integration
test.

Failure test for non existing pages/sites is refactored and
PageIndexer adapted, even if AfterCacheableContentIsGeneratedEvent
is not dispatched e.g. as the page is not found, the response will
always contain the pageIndexed flag.

Additionally the methods of PageIndexer that were defined as public
to simplify testing are now protected, the tests are adapted
accordingly. If you have used this methods, you have to adapt your
code. Affected methods:
- setupConfiguration
- index
- indexPage

Relates: TYPO3-Solr#3735
dkd-kaehm pushed a commit that referenced this issue Oct 10, 2023
Fixes indexing of access protected pages and/or page contents.

Resolves: #3735
dkd-kaehm pushed a commit that referenced this issue Oct 10, 2023
Cleans and optimizes the frontend helper "PageIndexer" integration
test.

Failure test for non existing pages/sites is refactored and
PageIndexer adapted, even if AfterCacheableContentIsGeneratedEvent
is not dispatched e.g. as the page is not found, the response will
always contain the pageIndexed flag.

Additionally the methods of PageIndexer that were defined as public
to simplify testing are now protected, the tests are adapted
accordingly. If you have used this methods, you have to adapt your
code. Affected methods:
- setupConfiguration
- index
- indexPage

Relates: #3735
dkd-friedrich added a commit that referenced this issue Oct 13, 2023
If event AfterCacheableContentIsGeneratedEvent is not dispatched
the indexing failed silently, this is fixed with #3735 but
the logging is faulty and doesn't consider the indexing status.
This commit fixes the logging, by checking the state in response
data array.

Relates: #3735
dkd-friedrich added a commit that referenced this issue Oct 13, 2023
Fixes the handling of root pages, slug "/", in SolrRoutingMiddleware.
On root pages the manipulated request uri contained duplicate slashes
that might cause issues, e.g. with InternalRequests in the integration
tests.

Relates: #3735
dkd-kaehm pushed a commit that referenced this issue Oct 13, 2023
If event AfterCacheableContentIsGeneratedEvent is not dispatched
the indexing failed silently, this is fixed with #3735 but
the logging is faulty and doesn't consider the indexing status.
This commit fixes the logging, by checking the state in response
data array.

Relates: #3735
dkd-kaehm pushed a commit that referenced this issue Oct 13, 2023
Fixes the handling of root pages, slug "/", in SolrRoutingMiddleware.
On root pages the manipulated request uri contained duplicate slashes
that might cause issues, e.g. with InternalRequests in the integration
tests.

Relates: #3735
dkd-kaehm added a commit to dkd-kaehm/ext-solr that referenced this issue Oct 13, 2023
dkd-kaehm added a commit to dkd-kaehm/ext-solr that referenced this issue Oct 13, 2023
dkd-kaehm added a commit to dkd-kaehm/ext-solr that referenced this issue Oct 13, 2023
dkd-kaehm added a commit that referenced this issue Oct 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging a pull request may close this issue.

3 participants