* @throws MWException
*/
private function checkDatabaseWikiId( IDatabase $db ) {
- $storeWiki = $this->loadBalancer->getLocalDomainID();
+ $storeWiki = $this->wikiId;
$dbWiki = $db->getDomainID();
if ( $dbWiki === $storeWiki ) {
return;
}
+ // XXX: we really want the default database ID...
+ $storeWiki = $storeWiki ?: wfWikiID();
+ $dbWiki = $dbWiki ?: wfWikiID();
+
+ if ( $dbWiki === $storeWiki ) {
+ return;
+ }
+
+ // HACK: counteract encoding imposed by DatabaseDomain
+ $storeWiki = str_replace( '?h', '-', $storeWiki );
+ $dbWiki = str_replace( '?h', '-', $dbWiki );
+
+ if ( $dbWiki === $storeWiki ) {
+ return;
+ }
+
throw new MWException( "RevisionStore for $storeWiki "
. "cannot be used with a DB connection for $dbWiki" );
}