One small change that was supposed to be in
5a6c18a0863 but didn't make
it into the patch version that got merged, and removal of some long-dead
code.
phan objected to the use of new $class without being explicitly
reassured that $class is, in fact, a string. I don't know why.
Change-Id: Ifa00c59ab4464109414f21db37e3a6db21decdf3
* See LockManager::__construct() for more details.
* Additional parameters are specific to the lock manager class used.
* These settings should be global to all wikis.
* 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.
// Lazy-load the actual lock manager instance
if ( !isset( $this->managers[$name]['instance'] ) ) {
$class = $this->managers[$name]['class'];
// 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'];
$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' );
$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 );
}
$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 {
* @return LockManagerGroup
*/
public function getLockManagerGroup( $domain = false ) : LockManagerGroup {
- if ( $domain === false ) {
+ if ( $domain === false || $domain === null ) {
$domain = $this->defaultDomain;
}
$domain = $this->defaultDomain;
}
LockManagerGroup::destroySingletons();
$this->assertSame(
LockManagerGroup::destroySingletons();
$this->assertSame(
+ WikiMap::getCurrentWikiDbDomain()->getId(),
LockManagerGroup::singleton( null )->config( 'a' )['domain']
);
}
LockManagerGroup::singleton( null )->config( 'a' )['domain']
);
}