Page MenuHomePhabricator

Getting "Param pages required!" when run refreshGlobalimagelinks.php (due to undocumented requirements)
Closed, ResolvedPublic

Description

I am using MW 1.27.1 with PHP 7.0.12-1~dotdeb+8.1

wgLBFactoryConf were used for GlobalUsage.

When I run php extensions/GlobalUsage/refreshGlobalimagelinks.php
I get "Param pages required!" with help info. No matter run it on wiki holding images or on wiki using remote images.

What is the Param pages referred here? Is this a bug?

error message:
php /extensions/GlobalUsage/refreshGlobalimagelinks.php
Param pages required!

Usage: php refreshGlobalimagelinks.php [--batch-size|--conf|--dbpass|--dbuser|--globals|--help|--memory-limit|--pages|--profiler|--quiet|--server|--start-image|--start-page|--wiki]

Generic maintenance parameters:

--help (-h): Display this help message
--quiet (-q): Whether to supress non-error output
--conf: Location of LocalSettings.php, if not default
--wiki: For specifying the wiki ID
--globals: Output globals at the end of processing for debugging
--memory-limit: Set a specific memory limit for the script, "max"
    for no limit or "default" to avoid changing it
--server: The protocol and server name to use in URLs, e.g.
    http://en.wikipedia.org. This is sometimes necessary because server name        detection may fail in command line scripts.
--profiler: Profiler output format (usually "text")

Script dependant parameters:

--dbuser: The DB user to use for this script
--dbpass: The password to use for this script
--batch-size: Run this many operations per batch, default: 500

Script specific parameters:

--pages: CSV of (existing,nonexisting)
--start-image: il_to of the image to start with
--start-page: page_id of the page to start with

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Is "Param pages required!" the literal output on the screen, or is that a translation to English for this bug report only?
I don't see any such message in the GlobalUsage code base...

Presumably, the --pages command-line parameter is indeed required? I'm not familiar with the extension.

The parameter was added in 7a244caa16505aa68667f364e7b0ef9e9568ab3e by @aaron to fix T65594 and doesn't appear to be documented anywhere.

The error message is coming from Maintenance::validateParamsAndArgs(): $this->error( "Param $opt required!" );.

Is "Param pages required!" the literal output on the screen, or is that a translation to English for this bug report only?
I don't see any such message in the GlobalUsage code base...

"Param pages required!" is the literal output on the screen. Not translation. I can't find any document or texts about how to use the --pages function :(

Try --pages=existing, or --pages=nonexisting, or --pages=existing,nonexisting.

Dereckson renamed this task from Gettign "Param pages required!" when run refreshGlobalimagelinks.php to Getting "Param pages required!" when run refreshGlobalimagelinks.php.Nov 8 2016, 12:44 AM

Cool, thank you @matmarex . --pages=existing,nonexisting work well. Hope the --pages=existing,nonexisting become the default value for refreshGlobalimagelinks.php, which will make life easier for everyone.

One more question, I don't find any Globalimage refresh job in Mediawiki's job types. Then how will the new file link be updated? Should I set up a cron job for refreshGlobalimagelinks.php, OR global links are updated though other method?

Aklapper renamed this task from Getting "Param pages required!" when run refreshGlobalimagelinks.php to Getting "Param pages required!" when run refreshGlobalimagelinks.php (due to undocumented requirements).Nov 8 2016, 3:28 PM
Aklapper added a project: Documentation.
matmarex claimed this task.

Cool, thank you @matmarex . --pages=existing,nonexisting work well. Hope the --pages=existing,nonexisting become the default value for refreshGlobalimagelinks.php, which will make life easier for everyone.

I don't really know why this was added. I just documented it: https://www.mediawiki.org/w/index.php?title=Extension:GlobalUsage&diff=2282816&oldid=1872828.

One more question, I don't find any Globalimage refresh job in Mediawiki's job types. Then how will the new file link be updated? Should I set up a cron job for refreshGlobalimagelinks.php, OR global links are updated though other method?

GlobalUsage piggy-backs on MediaWiki's built-in LinksUpdate jobs, using the LinksUpdateComplete hook. As long as your job queue is functional, and local image links are getting updated, the code to upgrade global image links should also run automatically. I think refreshGlobalimagelinks.php only needs to be run once when installing the extension. I documented this too: https://www.mediawiki.org/w/index.php?title=Extension:GlobalUsage&diff=2282817&oldid=2282816.