From c5b7101a1573b28178d37a5543260b0dc8c35e50 Mon Sep 17 00:00:00 2001 From: Derick Alangi Date: Sun, 21 Jul 2019 15:32:13 +0100 Subject: [PATCH] Avoid usage of deprecated Revision::* constants Change-Id: Ibb55d5a01f997f9c79bcf2f5e09d4f02d22152d2 --- includes/changes/ChangesList.php | 2 +- includes/diff/DifferenceEngine.php | 12 +++++++++--- includes/page/Article.php | 8 ++++---- includes/page/WikiPage.php | 10 +++++----- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/includes/changes/ChangesList.php b/includes/changes/ChangesList.php index 4e32385c24..0b0378c6c0 100644 --- a/includes/changes/ChangesList.php +++ b/includes/changes/ChangesList.php @@ -614,7 +614,7 @@ class ChangesList extends ContextSource { * @return string */ public function insertComment( $rc ) { - if ( $this->isDeleted( $rc, Revision::DELETED_COMMENT ) ) { + if ( $this->isDeleted( $rc, RevisionRecord::DELETED_COMMENT ) ) { return ' ' . $this->msg( 'rev-deleted-comment' )->escaped() . ''; } else { diff --git a/includes/diff/DifferenceEngine.php b/includes/diff/DifferenceEngine.php index cd51445f8b..54cd9ca822 100644 --- a/includes/diff/DifferenceEngine.php +++ b/includes/diff/DifferenceEngine.php @@ -1869,13 +1869,17 @@ class DifferenceEngine extends ContextSource { } if ( $this->mOldRev ) { - $this->mOldContent = $this->mOldRev->getContent( Revision::FOR_THIS_USER, $this->getUser() ); + $this->mOldContent = $this->mOldRev->getContent( + RevisionRecord::FOR_THIS_USER, $this->getUser() + ); if ( $this->mOldContent === null ) { return false; } } - $this->mNewContent = $this->mNewRev->getContent( Revision::FOR_THIS_USER, $this->getUser() ); + $this->mNewContent = $this->mNewRev->getContent( + RevisionRecord::FOR_THIS_USER, $this->getUser() + ); Hooks::run( 'DifferenceEngineLoadTextAfterNewContentIsLoaded', [ $this ] ); if ( $this->mNewContent === null ) { return false; @@ -1900,7 +1904,9 @@ class DifferenceEngine extends ContextSource { return false; } - $this->mNewContent = $this->mNewRev->getContent( Revision::FOR_THIS_USER, $this->getUser() ); + $this->mNewContent = $this->mNewRev->getContent( + RevisionRecord::FOR_THIS_USER, $this->getUser() + ); Hooks::run( 'DifferenceEngineAfterLoadNewText', [ $this ] ); diff --git a/includes/page/Article.php b/includes/page/Article.php index a9ef2c1023..f158e4df0b 100644 --- a/includes/page/Article.php +++ b/includes/page/Article.php @@ -2414,7 +2414,7 @@ class Article implements Page { * Call to WikiPage function for backwards compatibility. * @see WikiPage::getComment */ - public function getComment( $audience = Revision::FOR_PUBLIC, User $user = null ) { + public function getComment( $audience = RevisionRecord::FOR_PUBLIC, User $user = null ) { return $this->mPage->getComment( $audience, $user ); } @@ -2446,7 +2446,7 @@ class Article implements Page { * Call to WikiPage function for backwards compatibility. * @see WikiPage::getCreator */ - public function getCreator( $audience = Revision::FOR_PUBLIC, User $user = null ) { + public function getCreator( $audience = RevisionRecord::FOR_PUBLIC, User $user = null ) { return $this->mPage->getCreator( $audience, $user ); } @@ -2558,7 +2558,7 @@ class Article implements Page { * Call to WikiPage function for backwards compatibility. * @see WikiPage::getUser */ - public function getUser( $audience = Revision::FOR_PUBLIC, User $user = null ) { + public function getUser( $audience = RevisionRecord::FOR_PUBLIC, User $user = null ) { return $this->mPage->getUser( $audience, $user ); } @@ -2566,7 +2566,7 @@ class Article implements Page { * Call to WikiPage function for backwards compatibility. * @see WikiPage::getUserText */ - public function getUserText( $audience = Revision::FOR_PUBLIC, User $user = null ) { + public function getUserText( $audience = RevisionRecord::FOR_PUBLIC, User $user = null ) { return $this->mPage->getUserText( $audience, $user ); } diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php index adc62a1bb1..173fdc6e97 100644 --- a/includes/page/WikiPage.php +++ b/includes/page/WikiPage.php @@ -813,7 +813,7 @@ class WikiPage implements Page, IDBAccessObject { * * @since 1.21 */ - public function getContent( $audience = Revision::FOR_PUBLIC, User $user = null ) { + public function getContent( $audience = RevisionRecord::FOR_PUBLIC, User $user = null ) { $this->loadLastEdit(); if ( $this->mLastRevision ) { return $this->mLastRevision->getContent( $audience, $user ); @@ -851,7 +851,7 @@ class WikiPage implements Page, IDBAccessObject { * to the $audience parameter * @return int User ID for the user that made the last article revision */ - public function getUser( $audience = Revision::FOR_PUBLIC, User $user = null ) { + public function getUser( $audience = RevisionRecord::FOR_PUBLIC, User $user = null ) { $this->loadLastEdit(); if ( $this->mLastRevision ) { return $this->mLastRevision->getUser( $audience, $user ); @@ -870,7 +870,7 @@ class WikiPage implements Page, IDBAccessObject { * to the $audience parameter * @return User|null */ - public function getCreator( $audience = Revision::FOR_PUBLIC, User $user = null ) { + public function getCreator( $audience = RevisionRecord::FOR_PUBLIC, User $user = null ) { $revision = $this->getOldestRevision(); if ( $revision ) { $userName = $revision->getUserText( $audience, $user ); @@ -889,7 +889,7 @@ class WikiPage implements Page, IDBAccessObject { * to the $audience parameter * @return string Username of the user that made the last article revision */ - public function getUserText( $audience = Revision::FOR_PUBLIC, User $user = null ) { + public function getUserText( $audience = RevisionRecord::FOR_PUBLIC, User $user = null ) { $this->loadLastEdit(); if ( $this->mLastRevision ) { return $this->mLastRevision->getUserText( $audience, $user ); @@ -908,7 +908,7 @@ class WikiPage implements Page, IDBAccessObject { * @return string|null Comment stored for the last article revision, or null if the specified * audience does not have access to the comment. */ - public function getComment( $audience = Revision::FOR_PUBLIC, User $user = null ) { + public function getComment( $audience = RevisionRecord::FOR_PUBLIC, User $user = null ) { $this->loadLastEdit(); if ( $this->mLastRevision ) { return $this->mLastRevision->getComment( $audience, $user ); -- 2.20.1