jenkins-bot has submitted this change and it was merged.

Change subject: Revision: mark getRaw*() methods as deprecated
......................................................................


Revision: mark getRaw*() methods as deprecated

   Revision->getRawUser()
=> Revision->getUser( Revision::RAW )

   Revision->getRawUserText()
=> Revision->getUserText( Revision::RAW )

   Revision->getRawComment()
=> Revision->getComment( Revision::RAW )

The body of Revision->getRawUserText() has been moved
into Revision->getUserText().
Every usage has been replaced.

Change-Id: Ic6fbfbc0507dcf88072fcb2a2e2364ae1436dce7
---
M RELEASE-NOTES-1.25
M includes/Linker.php
M includes/Revision.php
M includes/Title.php
M includes/api/ApiQueryRevisionsBase.php
M includes/diff/DifferenceEngine.php
M includes/page/WikiPage.php
M includes/specials/SpecialUndelete.php
8 files changed, 38 insertions(+), 29 deletions(-)

Approvals:
  Daniel Kinzler: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/RELEASE-NOTES-1.25 b/RELEASE-NOTES-1.25
index 76295a9..1ba6e97 100644
--- a/RELEASE-NOTES-1.25
+++ b/RELEASE-NOTES-1.25
@@ -316,6 +316,7 @@
       $form->setDisplayFormat( 'vform' ); // throws exception
     Instead, do this:
       $form = HTMLForm::factory( 'vform', … );
+* Deprecated Revision methods getRawUser(), getRawUserText() and 
getRawComment().
 
 == Compatibility ==
 
diff --git a/includes/Linker.php b/includes/Linker.php
index 7840868..f220eba 100644
--- a/includes/Linker.php
+++ b/includes/Linker.php
@@ -1605,7 +1605,7 @@
         * @return string HTML fragment
         */
        public static function revComment( Revision $rev, $local = false, 
$isPublic = false ) {
-               if ( $rev->getRawComment() == "" ) {
+               if ( $rev->getComment( Revision::RAW ) == "" ) {
                        return "";
                }
                if ( $rev->isDeleted( Revision::DELETED_COMMENT ) && $isPublic 
) {
@@ -1870,7 +1870,7 @@
                $editCount = 0;
                $moreRevs = false;
                foreach ( $res as $row ) {
-                       if ( $rev->getRawUserText() != $row->rev_user_text ) {
+                       if ( $rev->getUserText( Revision::RAW ) != 
$row->rev_user_text ) {
                                if ( $verify &&
                                        ( $row->rev_deleted & 
Revision::DELETED_TEXT
                                                || $row->rev_deleted & 
Revision::DELETED_USER
diff --git a/includes/Revision.php b/includes/Revision.php
index c8015e6..90cc35a 100644
--- a/includes/Revision.php
+++ b/includes/Revision.php
@@ -826,9 +826,11 @@
         * Fetch revision's user id without regard for the current user's 
permissions
         *
         * @return string
+        * @deprecated since 1.25, use getUser( Revision::RAW )
         */
        public function getRawUser() {
-               return $this->mUser;
+               wfDeprecated( __METHOD__, '1.25' );
+               return $this->getUser( self::RAW );
        }
 
        /**
@@ -850,7 +852,15 @@
                } elseif ( $audience == self::FOR_THIS_USER && !$this->userCan( 
self::DELETED_USER, $user ) ) {
                        return '';
                } else {
-                       return $this->getRawUserText();
+                       if ( $this->mUserText === null ) {
+                               $this->mUserText = User::whoIs( $this->mUser ); 
// load on demand
+                               if ( $this->mUserText === false ) {
+                                       # This shouldn't happen, but it can if 
the wiki was recovered
+                                       # via importing revs and there is no 
user table entry yet.
+                                       $this->mUserText = $this->mOrigUserText;
+                               }
+                       }
+                       return $this->mUserText;
                }
        }
 
@@ -858,17 +868,11 @@
         * Fetch revision's username without regard for view restrictions
         *
         * @return string
+        * @deprecated since 1.25, use getUserText( Revision::RAW )
         */
        public function getRawUserText() {
-               if ( $this->mUserText === null ) {
-                       $this->mUserText = User::whoIs( $this->mUser ); // load 
on demand
-                       if ( $this->mUserText === false ) {
-                               # This shouldn't happen, but it can if the wiki 
was recovered
-                               # via importing revs and there is no user table 
entry yet.
-                               $this->mUserText = $this->mOrigUserText;
-                       }
-               }
-               return $this->mUserText;
+               wfDeprecated( __METHOD__, '1.25' );
+               return $this->getUserText( self::RAW );
        }
 
        /**
@@ -898,9 +902,11 @@
         * Fetch revision comment without regard for the current user's 
permissions
         *
         * @return string
+        * @deprecated since 1.25, use getComment( Revision::RAW )
         */
        public function getRawComment() {
-               return $this->mComment;
+               wfDeprecated( __METHOD__, '1.25' );
+               return $this->getComment( self::RAW );
        }
 
        /**
@@ -936,7 +942,7 @@
                $dbr = wfGetDB( DB_SLAVE );
                return RecentChange::newFromConds(
                        array(
-                               'rc_user_text' => $this->getRawUserText(),
+                               'rc_user_text' => $this->getUserText( 
Revision::RAW ),
                                'rc_timestamp' => $dbr->timestamp( 
$this->getTimestamp() ),
                                'rc_this_oldid' => $this->getId()
                        ),
diff --git a/includes/Title.php b/includes/Title.php
index bb4d04e..ca12322 100644
--- a/includes/Title.php
+++ b/includes/Title.php
@@ -4154,17 +4154,19 @@
                }
                // No DB query needed if $old and $new are the same or 
successive revisions:
                if ( $old->getId() === $new->getId() ) {
-                       return ( $old_cmp === '>' && $new_cmp === '<' ) ? 
array() : array( $old->getRawUserText() );
+                       return ( $old_cmp === '>' && $new_cmp === '<' ) ?
+                               array() :
+                               array( $old->getUserText( Revision::RAW ) );
                } elseif ( $old->getId() === $new->getParentId() ) {
                        if ( $old_cmp === '>=' && $new_cmp === '<=' ) {
-                               $authors[] = $old->getRawUserText();
-                               if ( $old->getRawUserText() != 
$new->getRawUserText() ) {
-                                       $authors[] = $new->getRawUserText();
+                               $authors[] = $old->getUserText( Revision::RAW );
+                               if ( $old->getUserText( Revision::RAW ) != 
$new->getUserText( Revision::RAW ) ) {
+                                       $authors[] = $new->getUserText( 
Revision::RAW );
                                }
                        } elseif ( $old_cmp === '>=' ) {
-                               $authors[] = $old->getRawUserText();
+                               $authors[] = $old->getUserText( Revision::RAW );
                        } elseif ( $new_cmp === '<=' ) {
-                               $authors[] = $new->getRawUserText();
+                               $authors[] = $new->getUserText( Revision::RAW );
                        }
                        return $authors;
                }
diff --git a/includes/api/ApiQueryRevisionsBase.php 
b/includes/api/ApiQueryRevisionsBase.php
index a658309..281f838 100644
--- a/includes/api/ApiQueryRevisionsBase.php
+++ b/includes/api/ApiQueryRevisionsBase.php
@@ -179,9 +179,9 @@
                        }
                        if ( $revision->userCan( Revision::DELETED_USER, $user 
) ) {
                                if ( $this->fld_user ) {
-                                       $vals['user'] = 
$revision->getRawUserText();
+                                       $vals['user'] = $revision->getUserText( 
Revision::RAW );
                                }
-                               $userid = $revision->getRawUser();
+                               $userid = $revision->getUser( Revision::RAW );
                                if ( !$userid ) {
                                        $vals['anon'] = '';
                                }
@@ -228,7 +228,7 @@
                                $anyHidden = true;
                        }
                        if ( $revision->userCan( Revision::DELETED_COMMENT, 
$user ) ) {
-                               $comment = $revision->getRawComment();
+                               $comment = $revision->getComment( Revision::RAW 
);
 
                                if ( $this->fld_comment ) {
                                        $vals['comment'] = $comment;
diff --git a/includes/diff/DifferenceEngine.php 
b/includes/diff/DifferenceEngine.php
index 47967e4..7b2ba0d 100644
--- a/includes/diff/DifferenceEngine.php
+++ b/includes/diff/DifferenceEngine.php
@@ -962,7 +962,7 @@
                        $users = $this->mNewPage->getAuthorsBetween( $oldRev, 
$newRev, $limit );
                        $numUsers = count( $users );
 
-                       if ( $numUsers == 1 && $users[0] == 
$newRev->getRawUserText() ) {
+                       if ( $numUsers == 1 && $users[0] == 
$newRev->getUserText( Revision::RAW ) ) {
                                $numUsers = 0; // special case to say "by the 
same user" instead of "by one other user"
                        }
 
diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php
index 8373dc0..9b98592 100644
--- a/includes/page/WikiPage.php
+++ b/includes/page/WikiPage.php
@@ -2983,8 +2983,8 @@
 
                // Get the last edit not by this guy...
                // Note: these may not be public values
-               $user = intval( $current->getRawUser() );
-               $user_text = $dbw->addQuotes( $current->getRawUserText() );
+               $user = intval( $current->getUser( Revision::RAW ) );
+               $user_text = $dbw->addQuotes( $current->getUserText( 
Revision::RAW ) );
                $s = $dbw->selectRow( 'revision',
                        array( 'rev_id', 'rev_timestamp', 'rev_deleted' ),
                        array( 'rev_page' => $current->getPage(),
diff --git a/includes/specials/SpecialUndelete.php 
b/includes/specials/SpecialUndelete.php
index 2ea1b12..fb2c421 100644
--- a/includes/specials/SpecialUndelete.php
+++ b/includes/specials/SpecialUndelete.php
@@ -550,7 +550,7 @@
                                'title' => $article->getTitle(), // used to 
derive default content model
                        )
                );
-               $user = User::newFromName( $revision->getRawUserText(), false );
+               $user = User::newFromName( $revision->getUserText( 
Revision::RAW ), false );
                $content = $revision->getContent( Revision::RAW );
 
                //NOTE: article ID may not be known yet. prepareSave() should 
not modify the database.
@@ -623,7 +623,7 @@
                $wasnew = $article->updateIfNewerOn( $dbw, $revision, 
$previousRevId );
                if ( $created || $wasnew ) {
                        // Update site stats, link tables, etc
-                       $user = User::newFromName( $revision->getRawUserText(), 
false );
+                       $user = User::newFromName( $revision->getUserText( 
Revision::RAW ), false );
                        $article->doEditUpdates(
                                $revision,
                                $user,

-- 
To view, visit https://gerrit.wikimedia.org/r/178565
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic6fbfbc0507dcf88072fcb2a2e2364ae1436dce7
Gerrit-PatchSet: 7
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Ricordisamoa <[email protected]>
Gerrit-Reviewer: Daniel Kinzler <[email protected]>
Gerrit-Reviewer: Ricordisamoa <[email protected]>
Gerrit-Reviewer: Umherirrender <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to