Add support for Number grouping(commafy) based on CLDR number grouping patterns like...
[lhc/web/wiklou.git] / includes / Revision.php
index 87b9ec4..243c9c0 100644 (file)
@@ -121,6 +121,16 @@ class Revision {
                return new self( $attribs );
        }
 
+       /**
+        * @since 1.19
+        *
+        * @param $row
+        * @return Revision
+        */
+       public static function newFromRow( $row ) {
+               return new self( $row );
+       }
+
        /**
         * Load a page revision from a given revision ID number.
         * Returns null if no such revision can be found.
@@ -359,15 +369,17 @@ class Revision {
                        $this->mTimestamp =         $row->rev_timestamp;
                        $this->mDeleted   = intval( $row->rev_deleted );
 
-                       if( !isset( $row->rev_parent_id ) )
+                       if( !isset( $row->rev_parent_id ) ) {
                                $this->mParentId = is_null($row->rev_parent_id) ? null : 0;
-                       else
+                       } else {
                                $this->mParentId  = intval( $row->rev_parent_id );
+                       }
 
-                       if( !isset( $row->rev_len ) || is_null( $row->rev_len ) )
+                       if( !isset( $row->rev_len ) || is_null( $row->rev_len ) ) {
                                $this->mSize = null;
-                       else
+                       } else {
                                $this->mSize = intval( $row->rev_len );
+                       }
 
                        if( isset( $row->page_latest ) ) {
                                $this->mCurrent = ( $row->rev_id == $row->page_latest );
@@ -471,8 +483,7 @@ class Revision {
                                   'rev_id' => $this->mId ),
                        'Revision::getTitle' );
                if( $row ) {
-                       $this->mTitle = Title::makeTitle( $row->page_namespace,
-                                                                                         $row->page_title );
+                       $this->mTitle = Title::makeTitle( $row->page_namespace, $row->page_title );
                }
                return $this->mTitle;
        }
@@ -618,7 +629,7 @@ class Revision {
        }
 
        /**
-        * int $field one of DELETED_* bitfield constants
+        * @param $field int one of DELETED_* bitfield constants
         *
         * @return Boolean
         */
@@ -628,6 +639,8 @@ class Revision {
 
        /**
         * Get the deletion bitfield of the revision
+        *
+        * @return int
         */
        public function getVisibility() {
                return (int)$this->mDeleted;
@@ -940,7 +953,7 @@ class Revision {
                if( isset( $this->mWikiID ) && $this->mWikiID !== false ) {
                        $key = wfForeignMemcKey( $this->mWikiID, null, 'revisiontext', 'textid', $textId );
                } else {
-                       $key = wfMemcKey( 'revisiontext', 'textid', $textId );
+               $key = wfMemcKey( 'revisiontext', 'textid', $textId );
                }
                if( $wgRevisionCacheExpiry ) {
                        $text = $wgMemc->get( $key );
@@ -1129,11 +1142,3 @@ class Revision {
                return 0;
        }
 }
-
-/**
- * Aliases for backwards compatibility with 1.6
- */
-define( 'MW_REV_DELETED_TEXT', Revision::DELETED_TEXT );
-define( 'MW_REV_DELETED_COMMENT', Revision::DELETED_COMMENT );
-define( 'MW_REV_DELETED_USER', Revision::DELETED_USER );
-define( 'MW_REV_DELETED_RESTRICTED', Revision::DELETED_RESTRICTED );