Merge "rdbms: make LBFactory "cliMode" check for phpdbg"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 11 Apr 2018 22:12:33 +0000 (22:12 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 11 Apr 2018 22:12:34 +0000 (22:12 +0000)
includes/libs/rdbms/lbfactory/LBFactory.php
includes/libs/rdbms/loadbalancer/LoadBalancer.php

index b1ea810..19b8fdc 100644 (file)
@@ -131,7 +131,9 @@ abstract class LBFactory implements ILBFactory {
                        'ChronologyPositionIndex' => isset( $_GET['cpPosIndex'] ) ? $_GET['cpPosIndex'] : null
                ];
 
-               $this->cliMode = isset( $conf['cliMode'] ) ? $conf['cliMode'] : PHP_SAPI === 'cli';
+               $this->cliMode = isset( $conf['cliMode'] )
+                       ? $conf['cliMode']
+                       : ( PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg' );
                $this->hostname = isset( $conf['hostname'] ) ? $conf['hostname'] : gethostname();
                $this->agent = isset( $conf['agent'] ) ? $conf['agent'] : '';
 
index db2ab1f..94acc1e 100644 (file)
@@ -539,7 +539,7 @@ class LoadBalancer implements ILoadBalancer {
                                if ( $this->loads[$i] > 0 ) {
                                        $start = microtime( true );
                                        $ok = $this->doWait( $i, true, $timeout ) && $ok;
-                                       $timeout -= ( microtime( true ) - $start );
+                                       $timeout -= intval( microtime( true ) - $start );
                                        if ( $timeout <= 0 ) {
                                                break; // timeout reached
                                        }