Merge "Use {{int:}} on MediaWiki:Blockedtext and MediaWiki:Autoblockedtext"
[lhc/web/wiklou.git] / includes / Storage / RevisionArchiveRecord.php
index 9999179..213ee3c 100644 (file)
@@ -67,6 +67,9 @@ class RevisionArchiveRecord extends RevisionRecord {
                parent::__construct( $title, $slots, $wikiId );
                Assert::parameterType( 'object', $row, '$row' );
 
+               $timestamp = wfTimestamp( TS_MW, $row->ar_timestamp );
+               Assert::parameter( is_string( $timestamp ), '$row->rev_timestamp', 'must be a valid timestamp' );
+
                $this->mArchiveId = intval( $row->ar_id );
 
                // NOTE: ar_page_id may be different from $this->mTitle->getArticleID() in some cases,
@@ -81,11 +84,11 @@ class RevisionArchiveRecord extends RevisionRecord {
                $this->mId = isset( $row->ar_rev_id ) ? intval( $row->ar_rev_id ) : null;
                $this->mComment = $comment;
                $this->mUser = $user;
-               $this->mTimestamp = wfTimestamp( TS_MW, $row->ar_timestamp );
+               $this->mTimestamp = $timestamp;
                $this->mMinorEdit = boolval( $row->ar_minor_edit );
                $this->mDeleted = intval( $row->ar_deleted );
-               $this->mSize = intval( $row->ar_len );
-               $this->mSha1 = isset( $row->ar_sha1 ) ? $row->ar_sha1 : null;
+               $this->mSize = isset( $row->ar_len ) ? intval( $row->ar_len ) : null;
+               $this->mSha1 = !empty( $row->ar_sha1 ) ? $row->ar_sha1 : null;
        }
 
        /**
@@ -94,7 +97,7 @@ class RevisionArchiveRecord extends RevisionRecord {
         * @return int
         */
        public function getArchiveId() {
-               return $this->mId;
+               return $this->mArchiveId;
        }
 
        /**