Hard deprecate Revision::getUserText, ::isMinor, and ::isCurrent
Bug: T250579 Bug: T250580 Bug: T250608 Change-Id: I89ac77c436245cad3e746b33aec5a42247fda67d
This commit is contained in:
parent
9efef14569
commit
1e36b2c12f
6 changed files with 37 additions and 5 deletions
|
|
@ -831,7 +831,6 @@ because of Phabricator reports.
|
|||
- LogEventsList::getExcludeClause
|
||||
- Revision::getComment
|
||||
- Revision::getUser
|
||||
- Revision::getUserText
|
||||
- WikiPage::getComment
|
||||
- WikiPage::getCreator
|
||||
- WikiPage::getUser
|
||||
|
|
@ -918,6 +917,9 @@ because of Phabricator reports.
|
|||
- ::setUserIdAndName - use MutableRevisionRecord::setUser instead
|
||||
- ::setId - use MutableRevisionRecord::setId instead
|
||||
- ::getRecentChange - use RevisionStore::getRecentChange instead
|
||||
- ::getUserText - use RevisionRecord::getUser and then User::getName instead
|
||||
- ::isMinor - use RevisionRecord::isMinor instead
|
||||
- ::isCurrent - use RevisionRecord::isCurrent instead
|
||||
- ::getTextId - use SlotRecord::getContentAddress for retrieving an actual
|
||||
content address, or RevisionRecord::hasSameContent to compare content
|
||||
- ::getNext - use RevisionLookup::getNextRevision instead
|
||||
|
|
|
|||
|
|
@ -638,6 +638,8 @@ class Revision implements IDBAccessObject {
|
|||
* If the specified audience does not have access to the username, an
|
||||
* empty string will be returned.
|
||||
*
|
||||
* @deprecated since 1.31 (soft), 1.35 (hard)
|
||||
*
|
||||
* @param int $audience One of:
|
||||
* Revision::FOR_PUBLIC to be displayed to all users
|
||||
* Revision::FOR_THIS_USER to be displayed to the given user
|
||||
|
|
@ -647,11 +649,8 @@ class Revision implements IDBAccessObject {
|
|||
* @return string
|
||||
*/
|
||||
public function getUserText( $audience = self::FOR_PUBLIC, User $user = null ) {
|
||||
wfDeprecated( __METHOD__, '1.31' );
|
||||
if ( $audience === self::FOR_THIS_USER && !$user ) {
|
||||
wfDeprecated(
|
||||
__METHOD__ . ' using FOR_THIS_USER without a user',
|
||||
'1.35'
|
||||
);
|
||||
global $wgUser;
|
||||
$user = $wgUser;
|
||||
}
|
||||
|
|
@ -686,9 +685,12 @@ class Revision implements IDBAccessObject {
|
|||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.31 (soft), 1.35 (hard)
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isMinor() {
|
||||
wfDeprecated( __METHOD__, '1.31' );
|
||||
return $this->mRecord->isMinor();
|
||||
}
|
||||
|
||||
|
|
@ -845,9 +847,12 @@ class Revision implements IDBAccessObject {
|
|||
}
|
||||
|
||||
/**
|
||||
* @deprecated since 1.31 (soft), 1.35 (hard)
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isCurrent() {
|
||||
wfDeprecated( __METHOD__, '1.31' );
|
||||
return $this->mRecord->isCurrent();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -862,6 +862,8 @@ abstract class RevisionStoreDbTestBase extends MediaWikiTestCase {
|
|||
|
||||
protected function revisionToRow( Revision $rev, $options = [ 'page', 'user', 'comment' ] ) {
|
||||
$this->hideDeprecated( 'Revision::getSha1' );
|
||||
$this->hideDeprecated( 'Revision::getUserText' );
|
||||
$this->hideDeprecated( 'Revision::isMinor' );
|
||||
|
||||
// XXX: the WikiPage object loads another RevisionRecord from the database. Not great.
|
||||
$page = WikiPage::factory( $rev->getTitle() );
|
||||
|
|
@ -918,6 +920,8 @@ abstract class RevisionStoreDbTestBase extends MediaWikiTestCase {
|
|||
RevisionRecord $record
|
||||
) {
|
||||
$this->hideDeprecated( 'Revision::getSha1' );
|
||||
$this->hideDeprecated( 'Revision::getUserText' );
|
||||
$this->hideDeprecated( 'Revision::isMinor' );
|
||||
|
||||
$this->assertSame( $rev->getId(), $record->getId() );
|
||||
$this->assertSame( $rev->getPage(), $record->getPageId() );
|
||||
|
|
|
|||
|
|
@ -206,6 +206,7 @@ class RevisionDbTest extends MediaWikiIntegrationTestCase {
|
|||
public function testGetRecentChange() {
|
||||
$this->hideDeprecated( 'Revision::getRecentChange' );
|
||||
$this->hideDeprecated( 'WikiPage::getRevision' );
|
||||
$this->hideDeprecated( 'Revision::getUserText' );
|
||||
|
||||
$rev = $this->testPage->getRevision();
|
||||
$recentChange = $rev->getRecentChange();
|
||||
|
|
@ -618,6 +619,7 @@ class RevisionDbTest extends MediaWikiIntegrationTestCase {
|
|||
*/
|
||||
public function testIsCurrent() {
|
||||
$this->hideDeprecated( 'WikiPage::getRevision' );
|
||||
$this->hideDeprecated( 'Revision::isCurrent' );
|
||||
|
||||
$rev1 = $this->testPage->getRevision();
|
||||
|
||||
|
|
@ -1382,6 +1384,8 @@ class RevisionDbTest extends MediaWikiIntegrationTestCase {
|
|||
*/
|
||||
public function testIsMinor_true() {
|
||||
$this->hideDeprecated( 'WikiPage::getRevision' );
|
||||
$this->hideDeprecated( 'Revision::isMinor' );
|
||||
|
||||
// Use a sysop to ensure we can mark edits as minor
|
||||
$sysop = $this->getTestSysop()->getUser();
|
||||
|
||||
|
|
@ -1402,6 +1406,8 @@ class RevisionDbTest extends MediaWikiIntegrationTestCase {
|
|||
*/
|
||||
public function testIsMinor_false() {
|
||||
$this->hideDeprecated( 'WikiPage::getRevision' );
|
||||
$this->hideDeprecated( 'Revision::isMinor' );
|
||||
|
||||
$this->testPage->doEditContent(
|
||||
new WikitextContent( __METHOD__ ),
|
||||
__METHOD__,
|
||||
|
|
@ -1436,6 +1442,8 @@ class RevisionDbTest extends MediaWikiIntegrationTestCase {
|
|||
*/
|
||||
public function testGetUserAndText() {
|
||||
$this->hideDeprecated( 'WikiPage::getRevision' );
|
||||
$this->hideDeprecated( 'Revision::getUserText' );
|
||||
|
||||
$sysop = $this->getTestSysop()->getUser();
|
||||
|
||||
$this->testPage->doEditContent(
|
||||
|
|
|
|||
|
|
@ -134,6 +134,8 @@ class RevisionTest extends MediaWikiTestCase {
|
|||
$expectedUserId,
|
||||
$expectedUserName
|
||||
) {
|
||||
$this->hideDeprecated( 'Revision::getUserText' );
|
||||
|
||||
$testUser = $this->getTestUser()->getUser();
|
||||
$this->setMwGlobals( 'wgUser', $testUser );
|
||||
if ( $expectedUserId === null ) {
|
||||
|
|
@ -213,6 +215,9 @@ class RevisionTest extends MediaWikiTestCase {
|
|||
],
|
||||
function ( RevisionTest $testCase, Revision $rev ) {
|
||||
$testCase->hideDeprecated( 'Revision::getSha1' );
|
||||
$testCase->hideDeprecated( 'Revision::getUserText' );
|
||||
$testCase->hideDeprecated( 'Revision::isMinor' );
|
||||
|
||||
$testCase->assertSame( 42, $rev->getId() );
|
||||
$testCase->assertSame( 23, $rev->getPage() );
|
||||
$testCase->assertSame( '20171017114835', $rev->getTimestamp() );
|
||||
|
|
@ -240,6 +245,9 @@ class RevisionTest extends MediaWikiTestCase {
|
|||
'rev_comment_cid' => null,
|
||||
],
|
||||
function ( RevisionTest $testCase, Revision $rev ) {
|
||||
$testCase->hideDeprecated( 'Revision::getUserText' );
|
||||
$testCase->hideDeprecated( 'Revision::isMinor' );
|
||||
|
||||
// parent ID may be null
|
||||
$testCase->assertSame( null, $rev->getParentId(), 'revision id' );
|
||||
|
||||
|
|
@ -327,6 +335,8 @@ class RevisionTest extends MediaWikiTestCase {
|
|||
*/
|
||||
public function testSetUserIdAndName( $inputId, $expectedId, $name ) {
|
||||
$this->hideDeprecated( 'Revision::setUserIdAndName' );
|
||||
$this->hideDeprecated( 'Revision::getUserText' );
|
||||
|
||||
$rev = new Revision( [], 0, $this->getMockTitle() );
|
||||
$rev->setUserIdAndName( $inputId, $name );
|
||||
$this->assertSame( $expectedId, $rev->getUser( Revision::RAW ) );
|
||||
|
|
@ -430,7 +440,9 @@ class RevisionTest extends MediaWikiTestCase {
|
|||
public function testLoadFromTitle() {
|
||||
$this->hideDeprecated( 'Revision::loadFromTitle' );
|
||||
$this->hideDeprecated( 'Revision::getSha1' );
|
||||
$this->hideDeprecated( 'Revision::getUserText' );
|
||||
$this->hideDeprecated( RevisionStore::class . '::loadRevisionFromTitle' );
|
||||
|
||||
$title = $this->getMockTitle();
|
||||
|
||||
$conditions = [
|
||||
|
|
|
|||
|
|
@ -1171,6 +1171,7 @@ more stuff
|
|||
$this->hideDeprecated( 'Revision::countByPageId' );
|
||||
$this->hideDeprecated( 'Revision::getSha1' );
|
||||
$this->hideDeprecated( 'WikiPage::getRevision' );
|
||||
$this->hideDeprecated( 'Revision::getUserText' );
|
||||
|
||||
$admin = $this->getTestSysop()->getUser();
|
||||
$user1 = $this->getTestUser()->getUser();
|
||||
|
|
|
|||
Loading…
Reference in a new issue