Index: trunk/phase3/includes/api/ApiQueryDeletedrevs.php |
— | — | @@ -53,6 +53,7 @@ |
54 | 54 | $fld_parsedcomment = isset ( $prop['parsedcomment'] ); |
55 | 55 | $fld_minor = isset( $prop['minor'] ); |
56 | 56 | $fld_len = isset( $prop['len'] ); |
| 57 | + $fld_sha1 = isset( $prop['sha1'] ); |
57 | 58 | $fld_content = isset( $prop['content'] ); |
58 | 59 | $fld_token = isset( $prop['token'] ); |
59 | 60 | |
— | — | @@ -101,6 +102,7 @@ |
102 | 103 | $this->addFieldsIf( 'ar_comment', $fld_comment || $fld_parsedcomment ); |
103 | 104 | $this->addFieldsIf( 'ar_minor_edit', $fld_minor ); |
104 | 105 | $this->addFieldsIf( 'ar_len', $fld_len ); |
| 106 | + $this->addFieldsIf( 'ar_sha1', $fld_sha1 ); |
105 | 107 | |
106 | 108 | if ( $fld_content ) { |
107 | 109 | $this->addTables( 'text' ); |
— | — | @@ -233,6 +235,9 @@ |
234 | 236 | if ( $fld_len ) { |
235 | 237 | $rev['len'] = $row->ar_len; |
236 | 238 | } |
| 239 | + if ( $fld_sha1 ) { |
| 240 | + $rev['sha1'] = $row->ar_sha1; |
| 241 | + } |
237 | 242 | if ( $fld_content ) { |
238 | 243 | ApiResult::setContent( $rev, Revision::getRevisionText( $row ) ); |
239 | 244 | } |
— | — | @@ -314,6 +319,7 @@ |
315 | 320 | 'parsedcomment', |
316 | 321 | 'minor', |
317 | 322 | 'len', |
| 323 | + 'sha1', |
318 | 324 | 'content', |
319 | 325 | 'token' |
320 | 326 | ), |
— | — | @@ -340,7 +346,8 @@ |
341 | 347 | ' comment - Adds the comment of the revision', |
342 | 348 | ' parsedcomment - Adds the parsed comment of the revision', |
343 | 349 | ' minor - Tags if the revision is minor', |
344 | | - ' len - Adds the length of the revision', |
| 350 | + ' len - Adds the length (bytes) of the revision', |
| 351 | + ' sha1 - Adds the SHA-1 (base 36) of the revision', |
345 | 352 | ' content - Adds the content of the revision', |
346 | 353 | ' token - Gives the edit token', |
347 | 354 | ), |
Index: trunk/phase3/includes/api/ApiQueryRevisions.php |
— | — | @@ -154,6 +154,7 @@ |
155 | 155 | $this->fld_comment = isset ( $prop['comment'] ); |
156 | 156 | $this->fld_parsedcomment = isset ( $prop['parsedcomment'] ); |
157 | 157 | $this->fld_size = isset ( $prop['size'] ); |
| 158 | + $this->fld_sha1 = isset ( $prop['sha1'] ); |
158 | 159 | $this->fld_userid = isset( $prop['userid'] ); |
159 | 160 | $this->fld_user = isset ( $prop['user'] ); |
160 | 161 | $this->token = $params['token']; |
— | — | @@ -412,6 +413,14 @@ |
413 | 414 | } |
414 | 415 | } |
415 | 416 | |
| 417 | + if ( $this->fld_sha1 ) { |
| 418 | + if ( !is_null( $revision->getSha1() ) ) { |
| 419 | + $vals['sha1'] = $revision->getSha1(); |
| 420 | + } else { |
| 421 | + $vals['sha1'] = ''; |
| 422 | + } |
| 423 | + } |
| 424 | + |
416 | 425 | if ( $this->fld_comment || $this->fld_parsedcomment ) { |
417 | 426 | if ( $revision->isDeleted( Revision::DELETED_COMMENT ) ) { |
418 | 427 | $vals['commenthidden'] = ''; |
— | — | @@ -537,6 +546,7 @@ |
538 | 547 | 'user', |
539 | 548 | 'userid', |
540 | 549 | 'size', |
| 550 | + 'sha1', |
541 | 551 | 'comment', |
542 | 552 | 'parsedcomment', |
543 | 553 | 'content', |
— | — | @@ -599,7 +609,8 @@ |
600 | 610 | ' timestamp - The timestamp of the revision', |
601 | 611 | ' user - User that made the revision', |
602 | 612 | ' userid - User id of revision creator', |
603 | | - ' size - Length of the revision', |
| 613 | + ' size - Length (bytes) of the revision', |
| 614 | + ' sha1 - SHA-1 (base 36) the revision', |
604 | 615 | ' comment - Comment by the user for revision', |
605 | 616 | ' parsedcomment - Parsed comment by the user for the revision', |
606 | 617 | ' content - Text of the revision', |