Page MenuHomePhabricator

Exit gracefully when running a maintenance script of an extension that isn't enabled on the current wiki
Closed, ResolvedPublic

Description

[16:24:23] <apergos> Fatal error: Class 'ContentTranslation\Translation' not found in /srv/mediawiki/php-1.28.0-wmf.12/extensions/ContentTranslation/scripts/dump-corpora.php on line 121
[16:25:30] <aude> o_O
[16:26:10] <Nikerabbit> apergos: huh? cx is not enabled outside wikipedia and testwiki
[16:26:21] <apergos> ah, then I have to wait til it makes it to the pedias
[16:26:22] <apergos> thanks then

Basically, without reinventing the wheel, and preferably, done in the Maintenance class, rather than on an individual script level... And also, WMF agnostic! With the extension loader stuff... We should be able to give a nicer error message when someone tries to run a script of an extension that isn't enabled on that wiki.

Maybe we'll need to define a class dependency in the early part of the script (feels a bit meh), or we try and deduce what extension it is from the path, and see if that matches up with the extensions being loaded

Something vaguely like the below would be a LOT nicer

"{$scriptName.php} cannot be run on this wiki due to $extensionName not being enabled. Try enabling it and try again?"

Event Timeline

Reedy renamed this task from Die more nicely when running maintence script if extension not enabled to Exit gracefully when running a maintenance script of an extension that isn't enabled on the current wiki.Jul 28 2016, 3:41 PM

Change 301709 had a related patch set uploaded (by Legoktm):
maintenance: Allow having a nicer error message if an extension isn't enabled

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

Change 301709 merged by jenkins-bot:
maintenance: Allow having a nicer error message if an extension isn't enabled

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