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] "Clear Index Queue" TypeError Site is null #4095

Closed
sal-lochbaum opened this issue Jun 24, 2024 · 1 comment
Closed

[BUG] "Clear Index Queue" TypeError Site is null #4095

sal-lochbaum opened this issue Jun 24, 2024 · 1 comment

Comments

@sal-lochbaum
Copy link

Describe the bug
When I click the "Clear Index Queue" button in the Index Queue backend module I get an error response from Typo3:

(1/1) TypeError
ApacheSolrForTypo3\Solr\IndexQueue\Queue::deleteItemsBySite(): Argument #1 ($site) must be of type ApacheSolrForTypo3\Solr\Domain\Site\Site, null given, called in /var/www/html/vendor/apache-solr-for-typo3/solr/Classes/Controller/Backend/Search/AbstractModuleController.php on line 231

To Reproduce
Steps to reproduce the behavior:

  1. Have multiple sites
  2. Go to Index Queue backend module
  3. Click on 'Clear Index Queue'
  4. Confirm the popup
  5. See error

Expected behavior
A clean index queue

Used versions (please complete the following information):

  • TYPO3 Version: 12.4.6
  • EXT:solr Version: latest dev-release-12.0.x
    This probably also applies to master/13 as the relevant code is the same.

Additional context
There is a fallback in AbstractModuleController->initializeAction called "autoSelectFirstSiteAndRootPageWhenOnlyOneSiteIsAvailable" which probably "hides" this bug if you only have one site.

As far as I could debug it:

  1. AbstractModuleController->clearIndexQueueAction() tries using $this->selectedSite which is null.
  2. The AbstractModuleController->initializeAction is responsible for setting the site but the id set in the frontend is not received in the backend. i.e. this condition is always false
if ($this->request->hasArgument('id')) {
    $this->selectedPageUID = (int)$this->request->getArgument('id');
}
  1. The id is set in the frontend, but the variable pageUID is null in IndexQueueModule/Index.html
    <f:form action="clearIndexQueue" additionalParams="{id: '{pageUID}'}">
  2. That fluid variable is beeing correctly set in AbstractModuleController->initializeView() but does not reach the Index.html

I narrowed it down to the initializeAction beeing called twice:

  1. initializeAction is called automatically by Typo3 -> creates new View
  2. initializeView is called automatically by Typo3
  3. initializeAction is called manually in IndexQueueModuleController->indexAction -> creates new View w/o variables from step 2

IMO the manual call should be deleted

    public function indexAction(): ResponseInterface
    {
        $this->initializeAction();
sal-lochbaum added a commit to salient-doremus/ext-solr that referenced this issue Jul 19, 2024
dkd-friedrich added a commit to dkd-friedrich/ext-solr that referenced this issue Jul 29, 2024
Fixes index queue clearance in multi site
environment.

Fixes: TYPO3-Solr#4095
Co-authored-by: Markus Friedrich <markus.friedrich@dkd.de>
dkd-friedrich added a commit to dkd-friedrich/ext-solr that referenced this issue Jul 30, 2024
Fixes index queue clearance in multi site
environment.

Fixes: TYPO3-Solr#4095
Co-authored-by: Markus Friedrich <markus.friedrich@dkd.de>
dkd-friedrich added a commit to dkd-friedrich/ext-solr that referenced this issue Jul 30, 2024
Fixes index queue clearance in multi site
environment.

Fixes: TYPO3-Solr#4095
Co-authored-by: Markus Friedrich <markus.friedrich@dkd.de>
dkd-kaehm pushed a commit that referenced this issue Jul 30, 2024
Fixes index queue clearance in multi site
environment.

Fixes: #4095
Co-authored-by: Markus Friedrich <markus.friedrich@dkd.de>
@dkd-friedrich
Copy link
Member

Fixed in #4120

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

No branches or pull requests

2 participants