// Detect $IP
$IP = getenv( 'MW_INSTALL_PATH' );
if ( $IP === false ) {
$IP = __DIR__ . '/../..';
}
// Require base maintenance class
require_once "$IP/maintenance/Maintenance.php";All Maintenance scripts in extensions end up with code like this. It's messy, and it's a PITA. Even more so with things like WikimediaMaintenance
Don't know if this should be an rfc... But IMHO, we should have some sort of wrapper script, which invokes maintenance scripts, wherever they lie.
So all maintenance scripts should be in the autoloader, and then you run something like
php maintenance/run.php ScriptNameHere --arg=1 --arg2=3
I'd hazard a guess, that something like this would be further beneficial when running hhvm in repo authoritative mode, where we end up with an "all in one" type of file...
But then, at the end, we wouldn't need the block of code at the top of every extension maintenance script, Or the
require_once __DIR__ . '/Maintenance.php';
in core ones, almost randomly guessing where Maintenance.php, which is not always obviously, especially if you symlink things in.