Merge "Remove Revision::loadFromId(), deprecated and unused"

This commit is contained in:
jenkins-bot 2020-03-03 11:49:13 +00:00 committed by Gerrit Code Review
commit fe13074a7b
4 changed files with 0 additions and 61 deletions

View file

@ -230,22 +230,6 @@ class Revision implements IDBAccessObject {
return new Revision( $rec );
}
/**
* Load a page revision from a given revision ID number.
* Returns null if no such revision can be found.
*
* @deprecated since 1.31, use RevisionStore::getRevisionById() instead.
*
* @param IDatabase $db
* @param int $id
* @return Revision|null
*/
public static function loadFromId( $db, $id ) {
wfDeprecated( __METHOD__, '1.31' ); // no known callers
$rec = self::getRevisionStore()->loadRevisionFromId( $db, $id );
return $rec ? new Revision( $rec ) : null;
}
/**
* Load either the current, or a specified, revision
* that's attached to a given page. If not attached

View file

@ -2387,24 +2387,6 @@ class RevisionStore
}
}
/**
* Load a page revision from a given revision ID number.
* Returns null if no such revision can be found.
*
* MCR migration note: this corresponds to Revision::loadFromId
*
* @note direct use is deprecated!
* @todo remove when unused! there seem to be no callers of Revision::loadFromId
*
* @param IDatabase $db
* @param int $id
*
* @return RevisionRecord|null
*/
public function loadRevisionFromId( IDatabase $db, $id ) {
return $this->loadRevisionFromConds( $db, [ 'rev_id' => intval( $id ) ] );
}
/**
* Load either the current, or a specified, revision
* that's attached to a given page. If not attached

View file

@ -1337,21 +1337,6 @@ abstract class RevisionStoreDbTestBase extends MediaWikiTestCase {
$this->assertRevisionExistsInDatabase( $restored );
}
/**
* @covers \MediaWiki\Revision\RevisionStore::loadRevisionFromId
*/
public function testLoadRevisionFromId() {
$title = Title::newFromText( __METHOD__ );
$page = WikiPage::factory( $title );
/** @var Revision $rev */
$rev = $page->doEditContent( new WikitextContent( __METHOD__ ), __METHOD__ )
->value['revision'];
$store = MediaWikiServices::getInstance()->getRevisionStore();
$result = $store->loadRevisionFromId( wfGetDB( DB_MASTER ), $rev->getId() );
$this->assertRevisionRecordMatchesRevision( $rev, $result );
}
/**
* @covers \MediaWiki\Revision\RevisionStore::loadRevisionFromPageId
*/

View file

@ -1104,18 +1104,6 @@ abstract class RevisionDbTestBase extends MediaWikiTestCase {
$this->assertSame( $content, $content2 );
}
/**
* @covers Revision::loadFromId
*/
public function testLoadFromId() {
$rev = $this->testPage->getRevision();
$this->hideDeprecated( 'Revision::loadFromId' );
$this->assertRevEquals(
$rev,
Revision::loadFromId( wfGetDB( DB_MASTER ), $rev->getId() )
);
}
/**
* @covers Revision::loadFromPageId
*/