}
/**
+ * @param bool|string $wikiId The ID of the target wiki database. Use false for the local wiki.
+ *
* @return SqlBlobStore
*/
- protected static function getBlobStore() {
- $store = MediaWikiServices::getInstance()->getBlobStore();
+ protected static function getBlobStore( $wiki = false ) {
+ $store = MediaWikiServices::getInstance()
+ ->getBlobStoreFactory()
+ ->newSqlBlobStore( $wiki );
if ( !$store instanceof SqlBlobStore ) {
throw new RuntimeException(
*
* @param object $row
* @param array $overrides
+ * @param Title $title (optional)
*
* @throws MWException
* @return Revision
*/
- public static function newFromArchiveRow( $row, $overrides = [] ) {
- $rec = self::getRevisionStore()->newRevisionFromArchiveRow( $row, 0, null, $overrides );
- return new Revision( $rec );
+ public static function newFromArchiveRow( $row, $overrides = [], Title $title = null ) {
+ /**
+ * MCR Migration: https://phabricator.wikimedia.org/T183564
+ * This method used to overwrite attributes, then passed to Revision::__construct
+ * RevisionStore::newRevisionFromArchiveRow instead overrides row field names
+ * So do a conversion here.
+ */
+ if ( array_key_exists( 'page', $overrides ) ) {
+ $overrides['page_id'] = $overrides['page'];
+ unset( $overrides['page'] );
+ }
+
+ $rec = self::getRevisionStore()->newRevisionFromArchiveRow( $row, 0, $title, $overrides );
+ return new Revision( $rec, self::READ_NORMAL, $title );
}
/**
* @return Revision|null
*/
public function getPrevious() {
- $rec = self::getRevisionStore()->getPreviousRevision( $this->mRecord );
- return $rec === null ? null : new Revision( $rec );
+ $rec = self::getRevisionStore()->getPreviousRevision( $this->mRecord, $this->getTitle() );
+ return $rec === null
+ ? null
+ : new Revision( $rec, self::READ_NORMAL, $this->getTitle() );
}
/**
* @return Revision|null
*/
public function getNext() {
- $rec = self::getRevisionStore()->getNextRevision( $this->mRecord );
- return $rec === null ? null : new Revision( $rec );
+ $rec = self::getRevisionStore()->getNextRevision( $this->mRecord, $this->getTitle() );
+ return $rec === null
+ ? null
+ : new Revision( $rec, self::READ_NORMAL, $this->getTitle() );
}
/**
$cacheKey = isset( $row->old_id ) ? ( 'tt:' . $row->old_id ) : null;
- return self::getBlobStore()->expandBlob( $text, $flags, $cacheKey );
+ return self::getBlobStore( $wiki )->expandBlob( $text, $flags, $cacheKey );
}
/**