-
-
Notifications
You must be signed in to change notification settings - Fork 255
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[!!!][FEATURE] Migrate IndexQueue hooks to PSR-14 events
More hooks have been removed: The hook :php:`$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr']['postProcessIndexQueueInitialization']` and its interface :php:`ApacheSolrForTypo3\Solr\IndexQueue\InitializationPostProcessor` are now superseded by the PSR-14 event :php:`ApacheSolrForTypo3\Solr\Event\IndexQueue\AfterIndexQueueHasBeenInitializedEvent` The hook :php:`$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr']['postProcessFetchRecordsForIndexQueueItem']` is now superseded by the PSR-14 event :php:`ApacheSolrForTypo3\Solr\Event\IndexQueue\AfterRecordsForIndexQueueItemsHaveBeenRetrievedEvent` Tests have been added and documentation has been adapted. Fixes: #3666
- Loading branch information
1 parent
4e7970e
commit a0e2ba7
Showing
9 changed files
with
213 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
Classes/Event/IndexQueue/AfterIndexQueueHasBeenInitializedEvent.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the TYPO3 CMS project. | ||
* | ||
* It is free software; you can redistribute it and/or modify it under | ||
* the terms of the GNU General Public License, either version 2 | ||
* of the License, or any later version. | ||
* | ||
* For the full copyright and license information, please read the | ||
* LICENSE.txt file that was distributed with this source code. | ||
* | ||
* The TYPO3 project - inspiring people to share! | ||
*/ | ||
|
||
namespace ApacheSolrForTypo3\Solr\Event\IndexQueue; | ||
|
||
use ApacheSolrForTypo3\Solr\Domain\Site\Site; | ||
use ApacheSolrForTypo3\Solr\IndexQueue\Initializer\AbstractInitializer; | ||
|
||
/** | ||
* PSR-14 Event which is fired after a index queue has been (re-) initialized. | ||
* | ||
* Previously used via $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr']['postProcessIndexQueueInitialization'] | ||
* and InitializationPostProcessor interface. | ||
*/ | ||
final class AfterIndexQueueHasBeenInitializedEvent | ||
{ | ||
public function __construct( | ||
private readonly AbstractInitializer $initializer, | ||
private readonly Site $site, | ||
private readonly string $indexingConfigurationName, | ||
private readonly string $type, | ||
private readonly array $indexingConfiguration, | ||
private bool $isInitialized | ||
) { | ||
} | ||
|
||
public function getInitializer(): AbstractInitializer | ||
{ | ||
return $this->initializer; | ||
} | ||
|
||
public function getSite(): Site | ||
{ | ||
return $this->site; | ||
} | ||
|
||
public function getIndexingConfigurationName(): string | ||
{ | ||
return $this->indexingConfigurationName; | ||
} | ||
|
||
public function getType(): string | ||
{ | ||
return $this->type; | ||
} | ||
|
||
public function getIndexingConfiguration(): array | ||
{ | ||
return $this->indexingConfiguration; | ||
} | ||
|
||
public function isInitialized(): bool | ||
{ | ||
return $this->isInitialized; | ||
} | ||
|
||
public function setIsInitialized(bool $isInitialized): void | ||
{ | ||
$this->isInitialized = $isInitialized; | ||
} | ||
} |
53 changes: 53 additions & 0 deletions
53
Classes/Event/IndexQueue/AfterRecordsForIndexQueueItemsHaveBeenRetrievedEvent.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the TYPO3 CMS project. | ||
* | ||
* It is free software; you can redistribute it and/or modify it under | ||
* the terms of the GNU General Public License, either version 2 | ||
* of the License, or any later version. | ||
* | ||
* For the full copyright and license information, please read the | ||
* LICENSE.txt file that was distributed with this source code. | ||
* | ||
* The TYPO3 project - inspiring people to share! | ||
*/ | ||
|
||
namespace ApacheSolrForTypo3\Solr\Event\IndexQueue; | ||
|
||
/** | ||
* PSR-14 Event which is fired after DB records have been fetched for the index queue. | ||
* | ||
* Previously used via $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['solr']['postProcessFetchRecordsForIndexQueueItem'] | ||
*/ | ||
final class AfterRecordsForIndexQueueItemsHaveBeenRetrievedEvent | ||
{ | ||
public function __construct( | ||
private readonly string $table, | ||
private readonly array $uids, | ||
private array $records | ||
) { | ||
} | ||
|
||
public function getTable(): string | ||
{ | ||
return $this->table; | ||
} | ||
|
||
public function getRecordUids(): array | ||
{ | ||
return $this->uids; | ||
} | ||
|
||
public function getRecords(): array | ||
{ | ||
return $this->records; | ||
} | ||
|
||
public function setRecords(array $records): void | ||
{ | ||
$this->records = $records; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.