Remove Revision::revText() and move functionality to getText()
authorAaron Schulz <aaron@users.mediawiki.org>
Mon, 22 Sep 2008 14:24:18 +0000 (14:24 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Mon, 22 Sep 2008 14:24:18 +0000 (14:24 +0000)
includes/Article.php
includes/Revision.php
includes/diff/DifferenceEngine.php
includes/specials/SpecialUndelete.php

index 66599f6..98ae798 100644 (file)
@@ -448,7 +448,7 @@ class Article {
 
                // FIXME: Horrible, horrible! This content-loading interface just plain sucks.
                // We should instead work with the Revision object when we need it...
-               $this->mContent   = $revision->revText(); // Loads if user is allowed
+               $this->mContent   = $revision->getText( false ); // Loads if user is allowed
 
                $this->mUser      = $revision->getUser();
                $this->mUserText  = $revision->getUserText();
index c6c8be8..79aa20f 100644 (file)
@@ -505,8 +505,10 @@ class Revision {
         * Fetch revision text if it's available to all users
         * @return string
         */
-       public function getText() {
-               if( $this->isDeleted( self::DELETED_TEXT ) ) {
+       public function getText( $isPublic = true ) {
+               if( $isPublic && $this->isDeleted( self::DELETED_TEXT ) ) {
+                       return "";
+               } else if( !$this->userCan( self::DELETED_TEXT ) ) {
                        return "";
                } else {
                        return $this->getRawText();
@@ -525,18 +527,6 @@ class Revision {
                return $this->mText;
        }
 
-       /**
-        * Fetch revision text if it's available to THIS user
-        * @return string
-        */
-       public function revText() {
-               if( !$this->userCan( self::DELETED_TEXT ) ) {
-                       return "";
-               } else {
-                       return $this->getRawText();
-               }
-       }
-
        /**
         * @return string
         */
index 7bfda1e..958af1b 100644 (file)
@@ -847,13 +847,13 @@ CONTROL;
                        return false;
                }
                if ( $this->mOldRev ) {
-                       $this->mOldtext = $this->mOldRev->revText();
+                       $this->mOldtext = $this->mOldRev->getText( false );
                        if ( $this->mOldtext === false ) {
                                return false;
                        }
                }
                if ( $this->mNewRev ) {
-                       $this->mNewtext = $this->mNewRev->revText();
+                       $this->mNewtext = $this->mNewRev->getText( false );
                        if ( $this->mNewtext === false ) {
                                return false;
                        }
index cfff82f..effa45c 100644 (file)
@@ -787,7 +787,7 @@ class UndeleteForm {
                        $popts = $wgOut->parserOptions();
                        $popts->setEditSection( false );
                        $wgOut->parserOptions( $popts );
-                       $wgOut->addWikiTextTitleTidy( $rev->revText(), $this->mTargetObj, true );
+                       $wgOut->addWikiTextTitleTidy( $rev->getText( false ), $this->mTargetObj, true );
                }
 
                $wgOut->addHtml(
@@ -795,7 +795,7 @@ class UndeleteForm {
                                        'readonly' => 'readonly',
                                        'cols' => intval( $wgUser->getOption( 'cols' ) ),
                                        'rows' => intval( $wgUser->getOption( 'rows' ) ) ),
-                               $rev->revText() . "\n" ) .
+                               $rev->getText( false ) . "\n" ) .
                        wfOpenElement( 'div' ) .
                        wfOpenElement( 'form', array(
                                'method' => 'post',