X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;ds=sidebyside;f=includes%2FStorage%2FRevisionArchiveRecord.php;h=213ee3cd1be024e23a72d5d133aeae62c34cff46;hb=285134ac5644fe424cf6e7df37aca5b831565641;hp=419cb95b0b30f1339676059070ec488d5dd03293;hpb=f036c5b324e2b2d240edf8d5eeb7fc2af3d88c47;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Storage/RevisionArchiveRecord.php b/includes/Storage/RevisionArchiveRecord.php index 419cb95b0b..213ee3cd1b 100644 --- a/includes/Storage/RevisionArchiveRecord.php +++ b/includes/Storage/RevisionArchiveRecord.php @@ -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; } /** @@ -107,6 +110,7 @@ class RevisionArchiveRecord extends RevisionRecord { } /** + * @throws RevisionAccessException if the size was unknown and could not be calculated. * @return int The nominal revision size, never null. May be computed on the fly. */ public function getSize() { @@ -120,6 +124,7 @@ class RevisionArchiveRecord extends RevisionRecord { } /** + * @throws RevisionAccessException if the hash was unknown and could not be calculated. * @return string The revision hash, never null. May be computed on the fly. */ public function getSha1() {