Treat phpdbg as run from the command line when checking PHP_SAPI
[lhc/web/wiklou.git] / includes / GlobalFunctions.php
index 523a0f9..7b77090 100644 (file)
@@ -2088,6 +2088,16 @@ function wfIsHHVM() {
        return defined( 'HHVM_VERSION' );
 }
 
        return defined( 'HHVM_VERSION' );
 }
 
+/**
+ * Check if we are running from the commandline
+ *
+ * @since 1.31
+ * @return bool
+ */
+function wfIsCLI() {
+       return PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg';
+}
+
 /**
  * Tries to get the system directory for temporary files. First
  * $wgTmpDirectory is checked, and then the TMPDIR, TMP, and TEMP
 /**
  * Tries to get the system directory for temporary files. First
  * $wgTmpDirectory is checked, and then the TMPDIR, TMP, and TEMP
@@ -3031,7 +3041,7 @@ function wfWaitForSlaves(
        $ifWritesSince = null, $wiki = false, $cluster = false, $timeout = null
 ) {
        if ( $timeout === null ) {
        $ifWritesSince = null, $wiki = false, $cluster = false, $timeout = null
 ) {
        if ( $timeout === null ) {
-               $timeout = ( PHP_SAPI === 'cli' ) ? 86400 : 10;
+               $timeout = wfIsCLI() ? 86400 : 10;
        }
 
        if ( $cluster === '*' ) {
        }
 
        if ( $cluster === '*' ) {