Page MenuHomePhabricator

Uncaught exception in forceSearchIndex.php when deserializing content
Closed, ResolvedPublic

Description

I have temporarily disabled the experimental WikiMaps extension that I worked on at the Zurich hackathon. It used a new content type, GeoJSON. Now if I try to index my wiki, I get an uncaught exception and the script dies. Instead, it should just skip the page and could report a warning about the issue.

In core, the code in the Revision class that handles getting the content first tries to get the ContentHandler, via ContentHandler::getForModelID. This throws plain MWException instead of MWContentSerializationException.

MWException from line 324 of /Library/WebServer/Documents/php-master/includes/content/ContentHandler.php: No handler for model 'GeoJSON' registered in $wgContentHandlers
Backtrace:
#0 /Library/WebServer/Documents/php-master/includes/Revision.php(1120): ContentHandler::getForModelID(string)
#1 /Library/WebServer/Documents/php-master/includes/Revision.php(1059): Revision->getContentHandler()
#2 /Library/WebServer/Documents/php-master/includes/Revision.php(1010): Revision->getContentInternal()
#3 /Library/WebServer/Documents/php-master/includes/page/WikiPage.php(655): Revision->getContent(integer, NULL)
#4 /Library/WebServer/Documents/php-master/extensions/CirrusSearch/maintenance/forceSearchIndex.php(359): WikiPage->getContent()
#5 /Library/WebServer/Documents/php-master/extensions/CirrusSearch/maintenance/forceSearchIndex.php(344): CirrusSearch\ForceSearchIndex->decodeResults(ResultWrapper, NULL)
#6 /Library/WebServer/Documents/php-master/extensions/CirrusSearch/maintenance/forceSearchIndex.php(158): CirrusSearch\ForceSearchIndex->findUpdates(NULL, string, NULL)
#7 /Library/WebServer/Documents/php-master/maintenance/doMaintenance.php(103): CirrusSearch\ForceSearchIndex->execute()
#8 /Library/WebServer/Documents/php-master/extensions/CirrusSearch/maintenance/forceSearchIndex.php(474): require_once(string)

Event Timeline

aude claimed this task.
aude raised the priority of this task from to Medium.
aude updated the task description. (Show Details)
aude added a project: CirrusSearch.
aude subscribed.

Change 198704 had a related patch set uploaded (by Aude):
Handle MWException in forceSearchIndex.php script

https://gerrit.wikimedia.org/r/198704

Change 198704 merged by jenkins-bot:
Handle MWException in forceSearchIndex.php script

https://gerrit.wikimedia.org/r/198704

aude removed a project: Patch-For-Review.
aude set Security to None.