Merge "Fix tabs inside/between statements/text"
[lhc/web/wiklou.git] / includes / Revision.php
index 4874490..984da69 100644 (file)
  */
 class Revision implements IDBAccessObject {
        protected $mId;
+
+       /**
+        * @var int|null
+        */
        protected $mPage;
        protected $mUserText;
        protected $mOrigUserText;
@@ -38,11 +42,23 @@ class Revision implements IDBAccessObject {
        protected $mComment;
        protected $mText;
        protected $mTextRow;
+
+       /**
+        * @var null|Title
+        */
        protected $mTitle;
        protected $mCurrent;
        protected $mContentModel;
        protected $mContentFormat;
+
+       /**
+        * @var Content
+        */
        protected $mContent;
+
+       /**
+        * @var null|ContentHandler
+        */
        protected $mContentHandler;
 
        // Revision deletion constants
@@ -87,7 +103,7 @@ class Revision implements IDBAccessObject {
         * @param $flags Integer Bitfield (optional)
         * @return Revision or null
         */
-       public static function newFromTitle( $title, $id = 0, $flags = null ) {
+       public static function newFromTitle( $title, $id = 0, $flags = 0 ) {
                $conds = array(
                        'page_namespace' => $title->getNamespace(),
                        'page_title'     => $title->getDBkey()
@@ -98,8 +114,6 @@ class Revision implements IDBAccessObject {
                } else {
                        // Use a join to get the latest revision
                        $conds[] = 'rev_id=page_latest';
-                       // Callers assume this will be up-to-date
-                       $flags = is_int( $flags ) ? $flags : self::READ_LATEST; // b/c
                }
                return self::newFromConds( $conds, (int)$flags );
        }
@@ -892,7 +906,7 @@ class Revision implements IDBAccessObject {
         * @return String
         */
        public function getText( $audience = self::FOR_PUBLIC, User $user = null ) {
-               wfDeprecated( __METHOD__, '1.21' );
+               ContentHandler::deprecated( __METHOD__, '1.21' );
 
                $content = $this->getContent( $audience, $user );
                return ContentHandler::getContentText( $content ); # returns the raw content text, if applicable
@@ -910,7 +924,7 @@ class Revision implements IDBAccessObject {
         * @param $user User object to check for, only if FOR_THIS_USER is passed
         *              to the $audience parameter
         * @since 1.21
-        * @return Content
+        * @return Content|null
         */
        public function getContent( $audience = self::FOR_PUBLIC, User $user = null ) {
                if( $audience == self::FOR_PUBLIC && $this->isDeleted( self::DELETED_TEXT ) ) {
@@ -942,8 +956,7 @@ class Revision implements IDBAccessObject {
         *                         or Revision::getSerializedData() as appropriate.
         */
        public function getRawText() {
-               wfDeprecated( __METHOD__, "1.21" );
-
+               ContentHandler::deprecated( __METHOD__, "1.21" );
                return $this->getText( self::RAW );
        }
 
@@ -969,7 +982,6 @@ class Revision implements IDBAccessObject {
 
                        $handler = $this->getContentHandler();
                        $format = $this->getContentFormat();
-                       $title = $this->getTitle();
 
                        if( is_null( $this->mText ) ) {
                                // Load text on demand:
@@ -1024,6 +1036,7 @@ class Revision implements IDBAccessObject {
        /**
         * Returns the content handler appropriate for this revision's content model.
         *
+        * @throws MWException
         * @return ContentHandler
         */
        public function getContentHandler() {