Page MenuHomePhabricator

PageImages Maintenance Script finds not all Images
Closed, ResolvedPublic5 Estimated Story Points

Description

After running 'php extensions/PageImages/maintenance/initImageData.php' manually, no images where found in ?action=info on each article.

Someone postet a workaround here:
https://www.mediawiki.org/w/index.php?title=Topic:Txp3e225prn7u8mf&topic_showPostId=uf6ic04q8nneq

This could be integrated into Mediawiki with this change: https://gerrit.wikimedia.org/r/458748

I suspect, something within includes/deferred/LinksUpdate.php is the real reason.

Developer notes

When running from a maintenance script LinksUpdate does not provide the Revision id (presumably as LinksUpdate::setRevision is never called). When this is the case, we can make use of the Title to obtain the relevant information.

Event Timeline

Hwboehm created this task.Sep 10 2018, 3:18 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptSep 10 2018, 3:18 PM
Bryandamon added a subscriber: Bryandamon.EditedSep 12 2018, 10:17 PM

I had the same issue with the following, PageImages isn't able to select and store images and when the PageImage maintenance script initImageData.php is run, the following errors are returned:

PHP Warning:  array_flip(): Can only flip STRING and INTEGER values! in /htdocs/extensions/PageImages/includes/ParserFileProcessingHookHandlers.php on line 123
PHP Warning:  array_flip(): Can only flip STRING and INTEGER values! in /htdocs/extensions/PageImages/includes/ParserFileProcessingHookHandlers.php on line 123

I followed the recommendation posted here:
https://www.mediawiki.org/w/index.php?title=Topic:Txp3e225prn7u8mf&topic_showPostId=uf6ic04q8nneq

It recommended updating LinksUpdateHookHandler.php (in PageImages/includes/) with the following:
Replace: $rev = $linksUpdate->getRevision();
With: $rev = Revision::newFromTitle($linksUpdate->getTitle());

This works and my images appear, however after running the PageImage maintenance script initImageData.php, the following error are returned:

PHP Notice:  Undefined variable: offsetStr in /htdocs/extensions/Cargo/includes/parserfunctions/CargoCompoundQuery.php on line 87
PHP Warning:  array_flip(): Can only flip STRING and INTEGER values! in /htdocs/extensions/PageImages/includes/ParserFileProcessingHookHandlers.php on line 123
PHP Warning:  array_flip(): Can only flip STRING and INTEGER values! in /htdocs/extensions/PageImages/includes/ParserFileProcessingHookHandlers.php on line 123
[1716a9def53f9757cc5a5b0a] [no req]   Error from line 47 of /htdocs/extensions/PageImages/includes/LinksUpdateHookHandler.php: Class 'PageImages\Hooks\Revision' not found
Backtrace:
#0 /htdocs/extensions/PageImages/includes/LinksUpdateHookHandler.php(70): PageImages\Hooks\LinksUpdateHookHandler->getPageImageCandidates(LinksUpdate)
#1 /htdocs/extensions/PageImages/includes/LinksUpdateHookHandler.php(32): PageImages\Hooks\LinksUpdateHookHandler->doLinksUpdate(LinksUpdate)
#2 /htdocs/includes/Hooks.php(177): PageImages\Hooks\LinksUpdateHookHandler::onLinksUpdate(LinksUpdate)
#3 /htdocs/includes/Hooks.php(205): Hooks::callHook(string, array, array, NULL)
#4 /htdocs/includes/deferred/LinksUpdate.php(175): Hooks::run(string, array)
#5 /htdocs/includes/deferred/DeferredUpdates.php(259): LinksUpdate->doUpdate()
#6 /htdocs/includes/deferred/DeferredUpdates.php(210): DeferredUpdates::runUpdate(LinksUpdate, Wikimedia\Rdbms\LBFactorySimple, string, integer)
#7 /htdocs/includes/deferred/DeferredUpdates.php(131): DeferredUpdates::execute(array, string, integer)
#8 /htdocs/includes/deferred/DeferredUpdates.php(291): DeferredUpdates::doUpdates(string)
#9 /htdocs/includes/deferred/DeferredUpdates.php(97): DeferredUpdates::tryOpportunisticExecute(string)
#10 /htdocs/maintenance/refreshLinks.php(278): DeferredUpdates::addUpdate(LinksUpdate)
#11 /htdocs/extensions/PageImages/includes/Job/InitImageDataJob.php(29): RefreshLinks::fixLinksFromArticle(string)
#12 /htdocs/extensions/PageImages/maintenance/initImageData.php(86): PageImages\Job\InitImageDataJob->run()
#13 /htdocs/maintenance/doMaintenance.php(94): InitImageData->execute()
#14 /htdocs/extensions/PageImages/maintenance/initImageData.php(122): require_once(string)
#15 {main}

Version info:
MW: 1.31.0
PHP: 7.0.30
PageImages: REL1_31

Change 458748 had a related patch set uploaded (by Jdlrobson; owner: Pboehm):
[mediawiki/extensions/PageImages@master] Reenable Indexing for Images

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

Jdlrobson triaged this task as Medium priority.Sep 19 2018, 12:00 AM
Jdlrobson added a subscriber: Jdlrobson.

Thanks for the patch submission!

Jdlrobson updated the task description. (Show Details)Sep 19 2018, 12:03 AM
Jdlrobson added subscribers: pmiazga, ovasileva.

@ovasileva we have a volunteer patch submission. Can we talk about this in next grooming so we can give the volunteer some long deserved feedback. cc @pmiazga

phuedx added a subscriber: phuedx.

Shame there isn't a Volunteer project tag…

I've moved this task onto the board as there's a change that needs our attention and we have an SLA to uphold /cc @ovasileva

ovasileva set the point value for this task to 5.Oct 1 2018, 5:15 PM

Change 458748 merged by jenkins-bot:
[mediawiki/extensions/PageImages@master] Reenable Indexing for Images

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

Jdrewniak closed this task as Resolved.Oct 9 2018, 3:36 PM