// rev_id is defined as NOT NULL, but this revision may not yet have been inserted.
if ( !$title && $revId !== null && $revId > 0 ) {
- $dbr = $this->getDbConnectionRef( $dbMode );
+ $dbr = $this->getDBConnectionRef( $dbMode );
// @todo: Title::getSelectFields(), or Title::getQueryInfo(), or something like that
$row = $dbr->selectRow(
[ 'revision', 'page' ],
* @param SlotRecord $slot The SlotRecord to load content for
* @param string|null $blobData The content blob, in the form indicated by $blobFlags
* @param string|null $blobFlags Flags indicating how $blobData needs to be processed.
- * null if no processing should happen.
+ * Use null if no processing should happen. That is in constrast to the empty string,
+ * which causes the blob to be decoded according to the configured legacy encoding.
* @param string|null $blobFormat MIME type indicating how $dataBlob is encoded
* @param int $queryFlags
*
$cacheKey = $slot->hasAddress() ? $slot->getAddress() : null;
if ( $blobFlags === null ) {
+ // No blob flags, so use the blob verbatim.
$data = $blobData;
} else {
$data = $this->blobStore->expandBlob( $blobData, $blobFlags, $cacheKey );
* @throws MWException
*/
private function checkDatabaseWikiId( IDatabase $db ) {
- $storeWiki = $this->wikiId;
+ $storeWiki = $this->loadBalancer->getLocalDomainID();
$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" );
}