Treat phpdbg as run from the command line when checking PHP_SAPI
authorKunal Mehta <legoktm@member.fsf.org>
Wed, 3 Jan 2018 06:51:44 +0000 (22:51 -0800)
committerKunal Mehta <legoktm@member.fsf.org>
Thu, 4 Jan 2018 07:00:37 +0000 (23:00 -0800)
commit251a0b97e5bb8711bac1784e90f9b7d61377e7da
tree560293cc6766ce2ff0a003d3aae3865b2a8bb229
parent2e248f0bb20cbdf7738a6d44a843eb546c3bbf23
Treat phpdbg as run from the command line when checking PHP_SAPI

phpdbg is a gdb-style debugger for PHP that is run from the command
line. However, it has a different PHP_SAPI value, so it was impossible
to run maintenance scripts with it (until now).

To avoid having to check both PHP_SAPI values in a bunch of places,
introduce wfIsCLI() to easily check whether running from the
command-line or not.

We're (CI team) interested in generating code coverage with phpdbg
instead of xdebug, hence this patch.

Bug: T184043
Change-Id: Id1f994ca146d7858cd8bb6ab6cdbb7718ff524fb
13 files changed:
includes/ForkController.php
includes/GlobalFunctions.php
includes/debug/logger/monolog/WikiProcessor.php
includes/exception/MWExceptionHandler.php
includes/libs/lockmanager/LockManager.php
includes/libs/rdbms/database/Database.php
includes/libs/rdbms/loadbalancer/LoadBalancer.php
includes/profiler/Profiler.php
includes/profiler/output/ProfilerOutputText.php
includes/utils/UIDGenerator.php
maintenance/Maintenance.php
maintenance/generateLocalAutoload.php
maintenance/mwdoc-filter.php