use Psr\Log\NullLogger;
use Wikimedia\ScopedCallback;
use Wikimedia\Timestamp\ConvertibleTimestamp;
-use Wikimedia;
+use Wikimedia\AtEase\AtEase;
use BagOStuff;
use HashBagOStuff;
use LogicException;
return null;
}
- public function setLBInfo( $name, $value = null ) {
- if ( is_null( $value ) ) {
- $this->lbInfo = $name;
+ public function setLBInfo( $nameOrArray, $value = null ) {
+ if ( is_array( $nameOrArray ) ) {
+ $this->lbInfo = $nameOrArray;
+ } elseif ( is_string( $nameOrArray ) ) {
+ if ( $value !== null ) {
+ $this->lbInfo[$nameOrArray] = $value;
+ } else {
+ unset( $this->lbInfo[$nameOrArray] );
+ }
} else {
- $this->lbInfo[$name] = $value;
+ throw new InvalidArgumentException( "Got non-string key" );
}
}
$fname = false,
callable $inputCallback = null
) {
- Wikimedia\suppressWarnings();
+ AtEase::suppressWarnings();
$fp = fopen( $filename, 'r' );
- Wikimedia\restoreWarnings();
+ AtEase::restoreWarnings();
if ( $fp === false ) {
throw new RuntimeException( "Could not open \"{$filename}\"" );
if ( $this->conn ) {
// Avoid connection leaks for sanity. Normally, resources close at script completion.
// The connection might already be closed in zend/hhvm by now, so suppress warnings.
- Wikimedia\suppressWarnings();
+ AtEase::suppressWarnings();
$this->closeConnection();
- Wikimedia\restoreWarnings();
- $this->conn = false;
+ AtEase::restoreWarnings();
+ $this->conn = null;
}
}
}