return $keyspace;
}
- return wfWikiID();
+ return WikiMap::getCurrentWikiDomain()->getId();
}
/**
* @throws InvalidArgumentException
*/
public static function newFromParams( $params ) {
- if ( isset( $params['loggroup'] ) ) {
- $params['logger'] = LoggerFactory::getInstance( $params['loggroup'] );
- } else {
- $params['logger'] = LoggerFactory::getInstance( 'objectcache' );
- }
+ $params['logger'] = LoggerFactory::getInstance( $params['loggroup'] ?? 'objectcache' );
if ( !isset( $params['keyspace'] ) ) {
$params['keyspace'] = self::getDefaultKeyspace();
}
} elseif ( isset( $params['class'] ) ) {
$class = $params['class'];
// Automatically set the 'async' update handler
- $params['asyncHandler'] = isset( $params['asyncHandler'] )
- ? $params['asyncHandler']
- : 'DeferredUpdates::addCallableUpdate';
+ $params['asyncHandler'] = $params['asyncHandler'] ?? 'DeferredUpdates::addCallableUpdate';
// Enable reportDupes by default
- $params['reportDupes'] = isset( $params['reportDupes'] )
- ? $params['reportDupes']
- : true;
+ $params['reportDupes'] = $params['reportDupes'] ?? true;
// Do b/c logic for SqlBagOStuff
if ( is_a( $class, SqlBagOStuff::class, true ) ) {
if ( isset( $params['server'] ) && !isset( $params['servers'] ) ) {
$cache = MediaWikiServices::getInstance()->getLocalServerObjectCache();
if ( $cache instanceof EmptyBagOStuff ) {
if ( is_array( $fallback ) ) {
- $fallback = isset( $fallback['fallback'] ) ? $fallback['fallback'] : CACHE_NONE;
+ $fallback = $fallback['fallback'] ?? CACHE_NONE;
}
$cache = self::getInstance( $fallback );
}
}
}
$params['cache'] = self::newFromParams( $params['store'] );
- if ( isset( $params['loggroup'] ) ) {
- $params['logger'] = LoggerFactory::getInstance( $params['loggroup'] );
- } else {
- $params['logger'] = LoggerFactory::getInstance( 'objectcache' );
- }
+ $params['logger'] = LoggerFactory::getInstance( $params['loggroup'] ?? 'objectcache' );
if ( !$wgCommandLineMode ) {
// Send the statsd data post-send on HTTP requests; avoid in CLI mode (T181385)
$params['stats'] = $services->getStatsdDataFactory();