use MediaWiki\Storage\MutableRevisionRecord;
use MediaWiki\Storage\RevisionAccessException;
+use MediaWiki\Storage\RevisionFactory;
+use MediaWiki\Storage\RevisionLookup;
use MediaWiki\Storage\RevisionRecord;
use MediaWiki\Storage\RevisionStore;
use MediaWiki\Storage\RevisionStoreRecord;
return MediaWikiServices::getInstance()->getRevisionStore();
}
+ /**
+ * @return RevisionLookup
+ */
+ protected static function getRevisionLookup() {
+ return MediaWikiServices::getInstance()->getRevisionLookup();
+ }
+
+ /**
+ * @return RevisionFactory
+ */
+ protected static function getRevisionFactory() {
+ return MediaWikiServices::getInstance()->getRevisionFactory();
+ }
+
/**
* @param bool|string $wiki The ID of the target wiki database. Use false for the local wiki.
*
* @return Revision|null
*/
public static function newFromId( $id, $flags = 0 ) {
- $rec = self::getRevisionStore()->getRevisionById( $id, $flags );
+ $rec = self::getRevisionLookup()->getRevisionById( $id, $flags );
return $rec === null ? null : new Revision( $rec, $flags );
}
* @return Revision|null
*/
public static function newFromTitle( LinkTarget $linkTarget, $id = 0, $flags = 0 ) {
- $rec = self::getRevisionStore()->getRevisionByTitle( $linkTarget, $id, $flags );
+ $rec = self::getRevisionLookup()->getRevisionByTitle( $linkTarget, $id, $flags );
return $rec === null ? null : new Revision( $rec, $flags );
}
* @return Revision|null
*/
public static function newFromPageId( $pageId, $revId = 0, $flags = 0 ) {
- $rec = self::getRevisionStore()->getRevisionByPageId( $pageId, $revId, $flags );
+ $rec = self::getRevisionLookup()->getRevisionByPageId( $pageId, $revId, $flags );
return $rec === null ? null : new Revision( $rec, $flags );
}
}
}
- $rec = self::getRevisionStore()->newRevisionFromArchiveRow( $row, 0, $title, $overrides );
+ $rec = self::getRevisionFactory()->newRevisionFromArchiveRow( $row, 0, $title, $overrides );
return new Revision( $rec, self::READ_NORMAL, $title );
}
*/
public static function newFromRow( $row ) {
if ( is_array( $row ) ) {
- $rec = self::getRevisionStore()->newMutableRevisionFromArray( $row );
+ $rec = self::getRevisionFactory()->newMutableRevisionFromArray( $row );
} else {
- $rec = self::getRevisionStore()->newRevisionFromRow( $row );
+ $rec = self::getRevisionFactory()->newRevisionFromRow( $row );
}
return new Revision( $rec );
$row['user'] = $wgUser;
}
- $this->mRecord = self::getRevisionStore()->newMutableRevisionFromArray(
+ $this->mRecord = self::getRevisionFactory()->newMutableRevisionFromArray(
$row,
$queryFlags,
$this->ensureTitle( $row, $queryFlags, $title )
);
} elseif ( is_object( $row ) ) {
- $this->mRecord = self::getRevisionStore()->newRevisionFromRow(
+ $this->mRecord = self::getRevisionFactory()->newRevisionFromRow(
$row,
$queryFlags,
$this->ensureTitle( $row, $queryFlags, $title )
*/
public function getPrevious() {
$title = $this->getTitle();
- $rec = self::getRevisionStore()->getPreviousRevision( $this->mRecord, $title );
+ $rec = self::getRevisionLookup()->getPreviousRevision( $this->mRecord, $title );
return $rec === null ? null : new Revision( $rec, self::READ_NORMAL, $title );
}
*/
public function getNext() {
$title = $this->getTitle();
- $rec = self::getRevisionStore()->getNextRevision( $this->mRecord, $title );
+ $rec = self::getRevisionLookup()->getNextRevision( $this->mRecord, $title );
return $rec === null ? null : new Revision( $rec, self::READ_NORMAL, $title );
}
return false;
}
- $record = self::getRevisionStore()->getKnownCurrentRevision( $title, $revId );
+ $record = self::getRevisionLookup()->getKnownCurrentRevision( $title, $revId );
return $record ? new Revision( $record ) : false;
}
}