Fix maintenance script failure when run as a child of a FastCGI worker
authorTim Starling <tstarling@wikimedia.org>
Fri, 8 Dec 2017 04:34:23 +0000 (15:34 +1100)
committerTim Starling <tstarling@wikimedia.org>
Fri, 8 Dec 2017 04:34:23 +0000 (15:34 +1100)
commit659f3779c33748ac66fb307e639648d839580130
tree61220d715cd8f6a7665d3e4ee01bfcaa4e0550de
parent185186e52297a82238124e01c84221f250846934
Fix maintenance script failure when run as a child of a FastCGI worker

Use PHP_SAPI==cli instead of checking $_SERVER['REQUEST_METHOD'],
since $_SERVER is populated from the environment when running HHVM in
CLI mode. Environment variables set by a FastCGI worker thus leak
through to child processes run via the shell, and cause this check to
fail.

When I wrote this check in March 2004 (r2803), I didn't know about
PHP_SAPI. Checking PHP_SAPI is quite sufficient to prevent web execution,
we use it in other places.

Bug: T111441
Change-Id: Iad8469ee25df4b0e0c2371e7975a300b1695dd8d
maintenance/Maintenance.php