Page MenuHomePhabricator

Web upgrade fail silently on Maintenance.php
Closed, DeclinedPublic

Description

The web updater uses updaters.inc, which require if needed
populateCategory.php, populateParentId.php, populateRevisionLength.php and populateLogSearch.php.
This used to be .inc before r63225. Since the .php have been ported to doMaintenance style (r54225), they use Maintenance.php, which exits if called from a web server.

Result of this, upgrading from old installs fails silently midway (the error message goes to stderr).

deleteDefaultMessages.php isn't affected since it directly calls the static reallyExecute()

1.16 doesn't seem affected.


Version: 1.17.x
Severity: blocker

Details

Reference
bz24301

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 11:03 PM
bzimport set Reference to bz24301.
bzimport added a subscriber: Unknown Object (MLST).

If we need to run maintenance scripts from the web, then presumably Maintenance.php should be fixed to allow that. (Or, if it can't be fixed that way for some fundamental reason, then we should scrap it and replace it with a system that does what we need.)

Of course we should be careful not to introduce security holes in doing so, but we need to be careful about that anyway if we want to allow maintenance without without shell access. Unfortunately, I'm not really familiar enough (read: at all) with the web updater to say anything more specific. But what we _don't_ need is two copies of each maintenance script, one using Maintenance.php and one not.

The problem is not just the check, if you comment it you get other errors:

Notice: Constant MEDIAWIKI already defined in mediawiki/maintenance/Maintenance.php on line 414

loadParamsAndArgs() gives several errors, since there's no global $argv:
Warning: array_shift() [function.array-shift]: The argument should be an array in mediawiki/maintenance/Maintenance.php on line 481

Warning: reset() [function.reset]: Passed variable is not an array or object in mediawiki/maintenance/Maintenance.php on line 487

doMaintenance assumes that it is being run in the global scope, but updaters.inc loads the files inside a function thus the $IP used is not the global one.

Notice: Undefined variable: IP in maintenance/doMaintenance.php on line 54

Notice: Undefined variable: IP in mediawiki/maintenance/doMaintenance.php on line 57

Warning: require_once(/includes/ProfilerStub.php) [function.require-once]: failed to open stream: No such file or directory in mediawiki/maintenance/doMaintenance.php on line 57

Fatal error: require_once() [function.require]: Failed opening required '/includes/ProfilerStub.php' in mediawiki/maintenance/doMaintenance.php on line 57

Then, doMaintenance calls Maintenance::loadSettings() which die because LocalSettings.php does not exist (the installer is trying to create it).

The scripts use wfGetDB( DB_MASTER ) instead of the global $wgDatabase

I don't see currently any problem with both old and new installer to upgrade an existing database. Can you see it it's fixed on your side?

I can't replicate this either. WFM.