X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/pie.php?a=blobdiff_plain;f=includes%2Flibs%2Frdbms%2Floadbalancer%2FLoadBalancer.php;h=d42fed959084c3daa034d90bf2e85ecbc806b524;hb=69ae945e8d39972a07bea89ddb64bc0189b43ac2;hp=4d2b74607064c5e0b38b1da728163dbe71049483;hpb=202f695f671bb1b6c25ebec219da348e9935692e;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/libs/rdbms/loadbalancer/LoadBalancer.php b/includes/libs/rdbms/loadbalancer/LoadBalancer.php index 4d2b746070..d42fed9590 100644 --- a/includes/libs/rdbms/loadbalancer/LoadBalancer.php +++ b/includes/libs/rdbms/loadbalancer/LoadBalancer.php @@ -21,6 +21,7 @@ * @ingroup Database */ use Psr\Log\LoggerInterface; +use Wikimedia\ScopedCallback; /** * Database connection, tracking, load balancing, and transaction manager for a cluster @@ -189,7 +190,7 @@ class LoadBalancer implements ILoadBalancer { $this->errorLogger = isset( $params['errorLogger'] ) ? $params['errorLogger'] : function ( Exception $e ) { - trigger_error( get_class( $e ) . ': ' . $e->getMessage(), E_WARNING ); + trigger_error( get_class( $e ) . ': ' . $e->getMessage(), E_USER_WARNING ); }; foreach ( [ 'replLogger', 'connLogger', 'queryLogger', 'perfLogger' ] as $key ) { @@ -552,7 +553,7 @@ class LoadBalancer implements ILoadBalancer { if ( $i == self::DB_REPLICA ) { $this->mLastError = 'Unknown error'; // reset error string # Try the general server pool if $groups are unavailable. - $i = in_array( false, $groups, true ) + $i = ( $groups === [ false ] ) ? false // don't bother with this if that is what was tried above : $this->getReaderIndex( false, $domain ); # Couldn't find a working server in getReaderIndex()? @@ -886,7 +887,7 @@ class LoadBalancer implements ILoadBalancer { // If all servers were busy, mLastError will contain something sensible throw new DBConnectionError( null, $this->mLastError ); } else { - $context['db_server'] = $conn->getProperty( 'mServer' ); + $context['db_server'] = $conn->getServer(); $this->connLogger->warning( "Connection error: {last_error} ({db_server})", $context