* See LockManager::__construct() for more details.
* Additional parameters are specific to the lock manager class used.
* These settings should be global to all wikis.
- *
- * When using DBLockManager, the 'dbsByBucket' map can reference 'localDBMaster' as
- * a peer database in each bucket. This will result in an extra connection to the domain
- * that the LockManager services, which must also be a valid wiki ID.
*/
$wgLockManagers = [];
// Lazy-load the actual lock manager instance
if ( !isset( $this->managers[$name]['instance'] ) ) {
$class = $this->managers[$name]['class'];
+ '@phan-var string $class';
$config = $this->managers[$name]['config'];
- if ( $class === DBLockManager::class ) {
- $lb = $this->lbFactory->getMainLB( $config['domain'] );
- $config['dbServers']['localDBMaster'] = $lb->getLazyConnectionRef(
- DB_MASTER,
- [],
- $config['domain'],
- $lb::CONN_TRX_AUTOCOMMIT
- );
- $config['srvCache'] = ObjectCache::getLocalServerInstance( 'hash' );
- }
$config['logger'] = LoggerFactory::getInstance( 'LockManager' );
- // XXX Looks like phan is right, we are trying to instantiate an abstract class and it
- // throws. Did this ever work? Presumably we need to detect the right subclass? Or
- // should we just get rid of this? It looks like it never worked since it was first
- // introduced by 0cf832a3394 in 2016, so if no one's complained until now, clearly it
- // can't be very useful?
- // @phan-suppress-next-line PhanTypeInstantiateAbstract
$this->managers[$name]['instance'] = new $class( $config );
}
}
/**
- * @param string|bool $domain Domain (usually wiki ID). false for the default (normally the
- * current wiki's domain).
+ * @param string|null|false $domain Domain (usually wiki ID). false for the default (normally
+ * the current wiki's domain).
* @return LockManagerGroup
*/
public function getLockManagerGroup( $domain = false ) : LockManagerGroup {
- if ( $domain === false ) {
+ if ( $domain === false || $domain === null ) {
$domain = $this->defaultDomain;
}