Merge "Use setMwGlobals in UserTest::testPasswordExpire"
[lhc/web/wiklou.git] / includes / Revision.php
index cad9f2c..e81ed75 100644 (file)
@@ -678,13 +678,8 @@ class Revision implements IDBAccessObject {
                        $this->mCurrent = false;
 
                        // If we still have no length, see it we have the text to figure it out
-                       if ( !$this->mSize ) {
-                               if ( $this->mContent !== null ) {
-                                       $this->mSize = $this->mContent->getSize();
-                               } else {
-                                       #NOTE: this should never happen if we have either text or content object!
-                                       $this->mSize = null;
-                               }
+                       if ( !$this->mSize && $this->mContent !== null ) {
+                               $this->mSize = $this->mContent->getSize();
                        }
 
                        // Same for sha1
@@ -1065,8 +1060,6 @@ class Revision implements IDBAccessObject {
                                $format = $this->getContentFormat();
 
                                $this->mContent = $handler->unserializeContent( $this->mText, $format );
-                       } else {
-                               $this->mContent = false; // negative caching!
                        }
                }
 
@@ -1658,7 +1651,7 @@ class Revision implements IDBAccessObject {
         *                          instead of just plain userrights
         * @return bool
         */
-       public static function userCanBitfield( $bitfield, $field, User $user = null ,
+       public static function userCanBitfield( $bitfield, $field, User $user = null,
                Title $title = null
        ) {
                if ( $bitfield & $field ) { // aspect is deleted
@@ -1680,7 +1673,7 @@ class Revision implements IDBAccessObject {
                        } else {
                                $text = $title->getPrefixedText();
                                wfDebug( "Checking for $permissionlist on $text due to $field match on $bitfield\n" );
-                               foreach( $permissions as $perm ) {
+                               foreach ( $permissions as $perm ) {
                                        if ( $title->userCan( $perm, $user ) ) {
                                                return true;
                                        }