Hard deprecate Revision::getTimestamp

Bug: T254966
Change-Id: I90d42eb4e69d7a9ab5c6e0197fbe6979f589ddb6
This commit is contained in:
DannyS712 2020-06-10 16:52:09 +00:00
parent ab81ccd32b
commit d95f663512
6 changed files with 20 additions and 1 deletions

View file

@ -1000,6 +1000,7 @@ because of Phabricator reports.
- ::getSize - use RevisionRecord::getSize instead
- ::isMinor - use RevisionRecord::isMinor instead
- ::isCurrent - use RevisionRecord::isCurrent instead
- ::getTimestamp - use RevisionRecord::getTimestamp instead
- ::getContent - use RevisionRecord::getContent instead
- ::getContentModel - use SlotRecord::getModel instead
- ::getContentFormat - use SlotRecord::getFormat instead, with a fallback

View file

@ -869,9 +869,12 @@ class Revision implements IDBAccessObject {
}
/**
* @deprecated since 1.31 (soft), 1.35 (hard)
*
* @return string
*/
public function getTimestamp() {
wfDeprecated( __METHOD__, '1.31' );
return $this->mRecord->getTimestamp();
}

View file

@ -192,6 +192,7 @@ class RevisionDbTest extends MediaWikiIntegrationTestCase {
$this->hideDeprecated( 'Revision::getContentHandler' );
$this->hideDeprecated( 'Revision::getContentModel' );
$this->hideDeprecated( 'Revision::getPage' );
$this->hideDeprecated( 'Revision::getTimestamp' );
$this->assertNotNull( $rev, 'missing revision' );
@ -212,6 +213,7 @@ class RevisionDbTest extends MediaWikiIntegrationTestCase {
$this->hideDeprecated( 'Revision::getUserText' );
$this->hideDeprecated( 'Revision::getPage' );
$this->hideDeprecated( 'Revision::getComment' );
$this->hideDeprecated( 'Revision::getTimestamp' );
$this->hideDeprecated( 'WikiPage::getRevision' );
$rev = $this->testPage->getRevision();
@ -797,6 +799,8 @@ class RevisionDbTest extends MediaWikiIntegrationTestCase {
* @covers Revision::insertOn
*/
public function testInsertOn() {
$this->hideDeprecated( 'Revision::getTimestamp' );
$ip = '2600:387:ed7:947e:8c16:a1ad:dd34:1dd7';
$orig = $this->makeRevisionWithProps( [
@ -829,6 +833,7 @@ class RevisionDbTest extends MediaWikiIntegrationTestCase {
public function testUserWasLastToEdit( $sinceIdx, $expectedLast ) {
$this->hideDeprecated( 'Revision::userWasLastToEdit' );
$this->hideDeprecated( 'Revision::insertOn' );
$this->hideDeprecated( 'Revision::getTimestamp' );
$userA = User::newFromName( "RevisionStorageTest_userA" );
$userB = User::newFromName( "RevisionStorageTest_userB" );
@ -1326,7 +1331,8 @@ class RevisionDbTest extends MediaWikiIntegrationTestCase {
* @covers Revision::loadFromTimestamp()
*/
public function testLoadFromTimestamp() {
$this->hideDeprecated( Revision::class . '::loadFromTimestamp' );
$this->hideDeprecated( 'Revision::loadFromTimestamp' );
$this->hideDeprecated( 'Revision::getTimestamp' );
$this->hideDeprecated( RevisionStore::class . '::loadRevisionFromTimestamp' );
$this->hideDeprecated( 'WikiPage::getRevision' );
$this->assertRevEquals(
@ -1464,6 +1470,7 @@ class RevisionDbTest extends MediaWikiIntegrationTestCase {
* @covers Revision::getTimestamp
*/
public function testGetTimestamp() {
$this->hideDeprecated( 'Revision::getTimestamp' );
$this->hideDeprecated( 'WikiPage::getRevision' );
$testTimestamp = wfTimestampNow();

View file

@ -227,6 +227,7 @@ class RevisionTest extends MediaWikiTestCase {
$testCase->hideDeprecated( 'Revision::getPage' );
$testCase->hideDeprecated( 'Revision::getComment' );
$testCase->hideDeprecated( 'Revision::getSize' );
$testCase->hideDeprecated( 'Revision::getTimestamp' );
$testCase->assertSame( 42, $rev->getId() );
$testCase->assertSame( 23, $rev->getPage() );
@ -260,6 +261,7 @@ class RevisionTest extends MediaWikiTestCase {
$testCase->hideDeprecated( 'Revision::getParentId' );
$testCase->hideDeprecated( 'Revision::getVisibility' );
$testCase->hideDeprecated( 'Revision::getComment' );
$testCase->hideDeprecated( 'Revision::getTimestamp' );
// parent ID may be null
$testCase->assertSame( null, $rev->getParentId(), 'revision id' );
@ -464,6 +466,7 @@ class RevisionTest extends MediaWikiTestCase {
$this->hideDeprecated( 'Revision::getParentId' );
$this->hideDeprecated( 'Revision::getComment' );
$this->hideDeprecated( 'Revision::getSize' );
$this->hideDeprecated( 'Revision::getTimestamp' );
$this->hideDeprecated( RevisionStore::class . '::loadRevisionFromTitle' );
$title = $this->getMockTitle();

View file

@ -332,6 +332,7 @@ class PageArchiveTest extends MediaWikiTestCase {
*/
public function testGetArchivedRevision() {
$this->hideDeprecated( 'Revision::getPage' );
$this->hideDeprecated( 'Revision::getTimestamp' );
$this->hideDeprecated( 'PageArchive::getArchivedRevision' );
$rev = $this->archivedPage->getArchivedRevision( $this->ipRev->getId() );

View file

@ -1964,7 +1964,9 @@ more stuff
* @covers WikiPage::updateIfNewerOn
*/
public function testUpdateIfNewerOn_olderRevision() {
$this->hideDeprecated( 'Revision::getTimestamp' );
$this->hideDeprecated( 'WikiPage::getRevision' );
$user = $this->getTestSysop()->getUser();
$page = $this->createPage( __METHOD__, 'StartText' );
$initialRevision = $page->getRevision();
@ -1999,7 +2001,9 @@ more stuff
* @covers WikiPage::updateIfNewerOn
*/
public function testUpdateIfNewerOn_newerRevision() {
$this->hideDeprecated( 'Revision::getTimestamp' );
$this->hideDeprecated( 'WikiPage::getRevision' );
$user = $this->getTestSysop()->getUser();
$page = $this->createPage( __METHOD__, 'StartText' );
$initialRevision = $page->getRevision();