Index: trunk/phase3/includes/Revision.php |
— | — | @@ -405,9 +405,14 @@ |
406 | 406 | |
407 | 407 | $this->mTitle = null; # Load on demand if needed |
408 | 408 | $this->mCurrent = false; |
409 | | - # If we still have no len_size, see it we have the text to figure it out |
410 | | - if ( !$this->mSize ) |
411 | | - $this->mSize = is_null( $this->mText ) ? null : strlen( $this->mText ); |
| 409 | + # If we still have no length, see it we have the text to figure it out |
| 410 | + if ( !$this->mSize ) { |
| 411 | + $this->mSize = is_null( $this->mText ) ? null : strlen( $this->mText ); |
| 412 | + } |
| 413 | + # Same for sha1 |
| 414 | + if ( $this->mSha1 === null ) { |
| 415 | + $this->mSha1 = is_null( $this->mText ) ? null : self::base36Sha1( $this->mText ); |
| 416 | + } |
412 | 417 | } else { |
413 | 418 | throw new MWException( 'Revision constructor passed invalid row format.' ); |
414 | 419 | } |
— | — | @@ -451,6 +456,15 @@ |
452 | 457 | } |
453 | 458 | |
454 | 459 | /** |
| 460 | + * Returns the base36 sha1 of the text in this revision, or null if unknown. |
| 461 | + * |
| 462 | + * @return String |
| 463 | + */ |
| 464 | + public function getSha1() { |
| 465 | + return $this->mSha1; |
| 466 | + } |
| 467 | + |
| 468 | + /** |
455 | 469 | * Returns the title of the page associated with this entry. |
456 | 470 | * |
457 | 471 | * @return Title |