(bug 28868) Include the number of pages in the default getLongDesc for multipaged...
[lhc/web/wiklou.git] / includes / Revision.php
index 5145033..fde0543 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 );
        }
@@ -149,7 +152,7 @@ class Revision {
         * WARNING: Timestamps may in some circumstances not be unique,
         * so this isn't the best key to use.
         *
-        * @param $db Database
+        * @param $db DatabaseBase
         * @param $title Title
         * @param $timestamp String
         * @return Revision or null
@@ -183,7 +186,7 @@ class Revision {
         * Given a set of conditions, fetch a revision from
         * the given database connection.
         *
-        * @param $db Database
+        * @param $db DatabaseBase
         * @param $conditions Array
         * @return Revision or null
         */
@@ -223,7 +226,7 @@ class Revision {
         * which will return matching database rows with the
         * fields necessary to build Revision objects.
         *
-        * @param $db Database
+        * @param $db DatabaseBase
         * @param $conditions Array
         * @return ResultWrapper
         */
@@ -246,7 +249,7 @@ class Revision {
         * Return the list of revision fields that should be selected to create
         * a new revision.
         */
-       static function selectFields() {
+       public static function selectFields() {
                return array(
                        'rev_id',
                        'rev_page',
@@ -314,7 +317,6 @@ class Revision {
 
                        if( isset( $row->page_latest ) ) {
                                $this->mCurrent = ( $row->rev_id == $row->page_latest );
-                               $row->page_id = $this->mPage;
                                $this->mTitle = Title::newFromRow( $row );
                        } else {
                                $this->mCurrent = false;
@@ -585,7 +587,6 @@ class Revision {
         *      Revision::FOR_THIS_USER    to be displayed to $wgUser
         *      Revision::RAW              get the text regardless of permissions
         *
-        *
         * @return String
         */
        public function getText( $audience = self::FOR_PUBLIC ) {
@@ -601,10 +602,11 @@ class Revision {
        /**
         * Alias for getText(Revision::FOR_THIS_USER)
         *
-        * @deprecated
+        * @deprecated since 1.17
         * @return String
         */
        public function revText() {
+               wfDeprecated( __METHOD__ );
                return $this->getText( self::FOR_THIS_USER );
        }
 
@@ -758,8 +760,8 @@ class Revision {
                                # Upconvert on demand.
                                # ("utf8" checked for compatibility with some broken
                                #  conversion scripts 2008-12-30)
-                               global $wgInputEncoding, $wgContLang;
-                               $text = $wgContLang->iconv( $wgLegacyEncoding, $wgInputEncoding, $text );
+                               global $wgContLang;
+                               $text = $wgContLang->iconv( $wgLegacyEncoding, 'UTF-8', $text );
                        }
                }
                wfProfileOut( __METHOD__ );
@@ -799,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 ) {
@@ -939,7 +941,7 @@ class Revision {
         * @param $pageId Integer: ID number of the page to read from
         * @param $summary String: revision's summary
         * @param $minor Boolean: whether the revision should be considered as minor
-        * @return Mixed: Revision, or null on error
+        * @return Revision|null on error
         */
        public static function newNullRevision( $dbw, $pageId, $summary, $minor ) {
                wfProfileIn( __METHOD__ );
@@ -997,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 ) {