Don't clobber revision size of 0
authorJackmcbarn <jackmcbarn@gmail.com>
Sun, 28 Sep 2014 03:52:19 +0000 (23:52 -0400)
committerJackmcbarn <jackmcbarn@gmail.com>
Mon, 29 Sep 2014 14:46:18 +0000 (10:46 -0400)
When a revision's size is 0, don't clobber it by changing it to null. This
causes, among other things, moves of empty pages to not show a revision
size. If we get to where the else used to be, either mSize is 0 (and doing
nothing is correct), or mSize is already null, in which case this didn't
do anything anyway. We know this because, above, we initialized it with
$this->mSize = isset( $row['len'] ) ? intval( $row['len'] ) : null;

Change-Id: I3d9b9163368c57b9a7906f6569119081b945d57e

includes/Revision.php

index 28a825d..5b39a41 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