]> scripts.mit.edu Git - autoinstalls/mediawiki.git/blobdiff - includes/Revision.php
MediaWiki 1.17.0
[autoinstalls/mediawiki.git] / includes / Revision.php
index 8d2c7e9d6b073b8d9b06ee33408a718a99197ec4..9cc49350bb3f4e2cdc67cd2a1af25e1bdb7985b4 100644 (file)
@@ -82,6 +82,9 @@ class Revision {
                if ( isset( $row->ar_text ) && !$row->ar_text_id ) {
                        // Pre-1.5 ar_text row
                        $attribs['text'] = self::getRevisionText( $row, 'ar_' );
+                       if ( $attribs['text'] === false ) {
+                               throw new MWException( 'Unable to load text from archive row (possibly bug 22624)' );
+                       }
                }
                return new self( $attribs );
        }
@@ -290,7 +293,7 @@ class Revision {
         * @param $row Mixed: either a database row or an array
         * @access private
         */
-       function Revision( $row ) {
+       function __construct( $row ) {
                if( is_object( $row ) ) {
                        $this->mId        = intval( $row->rev_id );
                        $this->mPage      = intval( $row->rev_page );
@@ -314,8 +317,7 @@ class Revision {
 
                        if( isset( $row->page_latest ) ) {
                                $this->mCurrent = ( $row->rev_id == $row->page_latest );
-                               $this->mTitle = Title::makeTitle( $row->page_namespace, $row->page_title );
-                               $this->mTitle->resetArticleID( $this->mPage );
+                               $this->mTitle = Title::newFromRow( $row );
                        } else {
                                $this->mCurrent = false;
                                $this->mTitle = null;
@@ -601,6 +603,7 @@ class Revision {
        /**
         * Alias for getText(Revision::FOR_THIS_USER)
         *
+        * @deprecated
         * @return String
         */
        public function revText() {
@@ -798,7 +801,7 @@ class Revision {
         * Insert a new revision into the database, returning the new revision ID
         * number on success and dies horribly on failure.
         *
-        * @param $dbw DatabaseBase (master connection)
+        * @param $dbw DatabaseBase: (master connection)
         * @return Integer
         */
        public function insertOn( $dbw ) {
@@ -996,7 +999,6 @@ class Revision {
        public static function userCanBitfield( $bitfield, $field ) {
                if( $bitfield & $field ) { // aspect is deleted
                        global $wgUser;
-                       $permission = '';
                        if ( $bitfield & self::DELETED_RESTRICTED ) {
                                $permission = 'suppressrevision';
                        } elseif ( $field & self::DELETED_TEXT ) {