Ah... we need relative paths!

   maintenance run ./extensions/MyExt/maintenance/someScript.php

That works great, but the class variants still don't work for me. Examples:

 > maintenance/run MediaWiki.Extension.GlobalBlocking.FixGlobalBlockWhitelist
Script 'MediaWiki.Extension.GlobalBlocking.FixGlobalBlockWhitelist' not found (tried path '/var/www/html/w/maintenance/MediaWiki.Extension.GlobalBlocking.FixGlobalBlockWhitelist.php' and class 'MediaWiki\Extension\GlobalBlocking\FixGlobalBlockWhitelist').

> maintenance/run GlobalBlocking:FixGlobalBlockWhitelist
Script 'GlobalBlocking:FixGlobalBlockWhitelist' not found (tried path '/var/www/html/w/extensions/GlobalBlocking/maintenance/FixGlobalBlockWhitelist.php' and class 'MediaWiki\Extension\GlobalBlocking\Maintenance\FixGlobalBlockWhitelist').

~ MA


On Thu, Mar 2, 2023 at 7:26 PM MusikAnimal <musikanimal@gmail.com> wrote:
Thanks! This works great for Core maintenance scripts, but it's not working for extensions on my end. I'm probably doing something stupid:

   maintenance/run extensions/MyExt/maintenance/someScript.php
   php maintenance/run.php extensions/MyExt/maintenance/someScript.php
   ...(and the other variants using the class name)

for all, I get the error:

  Script 'extensions/MyExt/maintenance/someScript.php' not found (tried path '/var/www/html/w/maintenance/extensions/MyExt/maintenance/someScript.php' and class 'extensions/MyExt/maintenance/someScript\php').

I tried several extensions. I of course am pointing to actual scripts and not the example MyExt::SomeScript :) MW and the extensions I tried on my machine are up-to-date with master. Any ideas? This error is what led me to believe that perhaps the scripts weren't built to support the new maintenance runner, but from what you're saying it sounds like no changes should be needed.

As far as docs go, is it too soon to start adding MW >=1.40 info at Manual:Writing maintenance scripts and Manual:Maintenance scripts/Running the scripts, etc.?

~ MA

On Wed, Mar 1, 2023 at 3:40 AM Antoine Musso <hashar@free.fr> wrote:
Le 28/02/2023 à 21:42, MusikAnimal a écrit :
Hello! Where might I find documentation on the new maintenance runner system? I can't find any examples in the Phabricator task or the linked RFC, and searching for "MaintenanceRunner" or "run.php" yields no results on mediawiki.org. Specifically, I was expecting Manual:run.php to exist with some info on how it works.

If given a good example patch, I'm happy to help write the docs :)

Hello,

run.php is more or less a wrapper so that instead of invoking:

 php maintenance/parse.php

One should use:

 maintenance/run parse

That will be released in MediaWiki 1.40 and all maintenance scripts will emit a warning to the console when invoked directly.

Here are some references to assist in writing the documentation:

And as an extra, I have implemented a back compat layer in Quibble (which is written in Python): https://gerrit.wikimedia.org/r/c/integration/quibble/+/875981/6/quibble/mediawiki/maintenance.py


Antoine "hashar" Musso
Wikimedia Release Engineering