jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/334414 )
Change subject: Fixes for more robust dealing with content handlers.
......................................................................
Fixes for more robust dealing with content handlers.
Change-Id: I12a02da005f4b2bceaa850bd1f41a90ac4e1754a
---
M includes/search/SearchEngine.php
1 file changed, 14 insertions(+), 1 deletion(-)
Approvals:
Daniel Kinzler: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/search/SearchEngine.php b/includes/search/SearchEngine.php
index 0bcb07a..87701cd 100644
--- a/includes/search/SearchEngine.php
+++ b/includes/search/SearchEngine.php
@@ -706,8 +706,21 @@
public function getSearchIndexFields() {
$models = ContentHandler::getContentModels();
$fields = [];
+ $seenHandlers = new SplObjectStorage();
foreach ( $models as $model ) {
- $handler = ContentHandler::getForModelID( $model );
+ try {
+ $handler = ContentHandler::getForModelID(
$model );
+ }
+ catch ( MWUnknownContentModelException $e ) {
+ // If we can find no handler, ignore it
+ continue;
+ }
+ // Several models can have the same handler, so avoid
processing it repeatedly
+ if ( $seenHandlers->contains( $handler ) ) {
+ // We already did this one
+ continue;
+ }
+ $seenHandlers->attach( $handler );
$handlerFields = $handler->getFieldsForSearchIndex(
$this );
foreach ( $handlerFields as $fieldName => $fieldData ) {
if ( empty( $fields[$fieldName] ) ) {
--
To view, visit https://gerrit.wikimedia.org/r/334414
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I12a02da005f4b2bceaa850bd1f41a90ac4e1754a
Gerrit-PatchSet: 3
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Smalyshev <[email protected]>
Gerrit-Reviewer: Aude <[email protected]>
Gerrit-Reviewer: DCausse <[email protected]>
Gerrit-Reviewer: Daniel Kinzler <[email protected]>
Gerrit-Reviewer: EBernhardson <[email protected]>
Gerrit-Reviewer: Fomafix <[email protected]>
Gerrit-Reviewer: Smalyshev <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits