public function testForceMaster() { $connection = $this->getConnectionMock(); $lb = $this->getLoadBalancerMock(); $lb->expects($this->once())->method('getConnection')->with(DB_MASTER)->will($this->returnValue($connection)); $manager = new ConsistentReadConnectionManager($lb); $manager->forceMaster(); $manager->getReadConnection(); }
/** * Remove subscriptions for entities not present in in wbc_entity_usage. * * @param EntityId|null $startEntity The entity to start with. */ public function purgeSubscriptions(EntityId $startEntity = null) { $continuation = $startEntity === null ? null : array($startEntity->getSerialization()); $this->repoConnectionManager->forceMaster(); while (true) { wfWaitForSlaves(null, $this->repoWiki); $count = $this->processDeletionBatch($continuation); if ($count > 0) { $this->progressReporter->reportMessage('Purging subscription table: ' . "deleted {$count} subscriptions, continuing at entity #{$continuation[0]}."); } else { break; } } }