r94364 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r94363‎ | r94364 | r94365 >
Date:17:29, 12 August 2011
Author:aaron
Status:reverted (Comments)
Tags:
Comment:
* Added Revision::getSha1 function
* Try to populate mSha1 when a Revision is made from an array (as rev_len does)
Modified paths:
  • /trunk/phase3/includes/Revision.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Revision.php
@@ -405,9 +405,14 @@
406406
407407 $this->mTitle = null; # Load on demand if needed
408408 $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+ }
412417 } else {
413418 throw new MWException( 'Revision constructor passed invalid row format.' );
414419 }
@@ -451,6 +456,15 @@
452457 }
453458
454459 /**
 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+ /**
455469 * Returns the title of the page associated with this entry.
456470 *
457471 * @return Title

Follow-up revisions

RevisionCommit summaryAuthorDate
r94547Followup r94541 (reverts of r94289 undiscussed core schema change and followu...brion18:52, 15 August 2011

Comments

#Comment by Brion VIBBER (talk | contribs)   18:48, 15 August 2011

Adding to the revert queue for r94289's evil minions

Status & tagging log