$fld_parsedcomment = isset ( $prop['parsedcomment'] );
$fld_minor = isset( $prop['minor'] );
$fld_len = isset( $prop['len'] );
+ $fld_sha1 = isset( $prop['sha1'] );
$fld_content = isset( $prop['content'] );
$fld_token = isset( $prop['token'] );
$this->addFieldsIf( 'ar_comment', $fld_comment || $fld_parsedcomment );
$this->addFieldsIf( 'ar_minor_edit', $fld_minor );
$this->addFieldsIf( 'ar_len', $fld_len );
+ $this->addFieldsIf( 'ar_sha1', $fld_sha1 );
if ( $fld_content ) {
$this->addTables( 'text' );
if ( $fld_len ) {
$rev['len'] = $row->ar_len;
}
+ if ( $fld_sha1 ) {
+ $rev['sha1'] = $row->ar_sha1;
+ }
if ( $fld_content ) {
ApiResult::setContent( $rev, Revision::getRevisionText( $row ) );
}
'parsedcomment',
'minor',
'len',
+ 'sha1',
'content',
'token'
),
' comment - Adds the comment of the revision',
' parsedcomment - Adds the parsed comment of the revision',
' minor - Tags if the revision is minor',
- ' len - Adds the length of the revision',
+ ' len - Adds the length (bytes) of the revision',
+ ' sha1 - Adds the SHA-1 (base 36) of the revision',
' content - Adds the content of the revision',
' token - Gives the edit token',
),
$this->fld_comment = isset ( $prop['comment'] );
$this->fld_parsedcomment = isset ( $prop['parsedcomment'] );
$this->fld_size = isset ( $prop['size'] );
+ $this->fld_sha1 = isset ( $prop['sha1'] );
$this->fld_userid = isset( $prop['userid'] );
$this->fld_user = isset ( $prop['user'] );
$this->token = $params['token'];
}
}
+ if ( $this->fld_sha1 ) {
+ if ( !is_null( $revision->getSha1() ) ) {
+ $vals['sha1'] = $revision->getSha1();
+ } else {
+ $vals['sha1'] = '';
+ }
+ }
+
if ( $this->fld_comment || $this->fld_parsedcomment ) {
if ( $revision->isDeleted( Revision::DELETED_COMMENT ) ) {
$vals['commenthidden'] = '';
'user',
'userid',
'size',
+ 'sha1',
'comment',
'parsedcomment',
'content',
' timestamp - The timestamp of the revision',
' user - User that made the revision',
' userid - User id of revision creator',
- ' size - Length of the revision',
+ ' size - Length (bytes) of the revision',
+ ' sha1 - SHA-1 (base 36) the revision',
' comment - Comment by the user for revision',
' parsedcomment - Parsed comment by the user for the revision',
' content - Text of the revision',