r94547 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r94546‎ | r94547 | r94548 >
Date:18:52, 15 August 2011
Author:brion
Status:ok
Tags:
Comment:
Followup r94541 (reverts of r94289 undiscussed core schema change and followups), two more that got missed: reverts of r94290, r94364
Modified paths:
  • /trunk/phase3/includes/Revision.php (modified) (history)
  • /trunk/phase3/includes/WikiPage.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialUndelete.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Revision.php
@@ -110,9 +110,7 @@
111111 'minor_edit' => $row->ar_minor_edit,
112112 'text_id' => isset( $row->ar_text_id ) ? $row->ar_text_id : null,
113113 'deleted' => $row->ar_deleted,
114 - 'len' => $row->ar_len,
115 - 'sha1' => $row->ar_sha1
116 - );
 114+ 'len' => $row->ar_len);
117115 if ( isset( $row->ar_text ) && !$row->ar_text_id ) {
118116 // Pre-1.5 ar_text row
119117 $attribs['text'] = self::getRevisionText( $row, 'ar_' );
@@ -303,8 +301,7 @@
304302 'rev_minor_edit',
305303 'rev_deleted',
306304 'rev_len',
307 - 'rev_parent_id',
308 - 'rev_sha1'
 305+ 'rev_parent_id'
309306 );
310307 }
311308
@@ -360,12 +357,6 @@
361358 $this->mSize = intval( $row->rev_len );
362359 }
363360
364 - if ( !isset( $row->rev_sha1 ) ) {
365 - $this->mSha1 = null;
366 - } else {
367 - $this->mSha1 = $row->rev_sha1;
368 - }
369 -
370361 if( isset( $row->page_latest ) ) {
371362 $this->mCurrent = ( $row->rev_id == $row->page_latest );
372363 $this->mTitle = Title::newFromRow( $row );
@@ -384,7 +375,7 @@
385376 }
386377 } elseif( is_array( $row ) ) {
387378 // Build a new revision to be saved...
388 - global $wgUser; // ugh
 379+ global $wgUser;
389380
390381 $this->mId = isset( $row['id'] ) ? intval( $row['id'] ) : null;
391382 $this->mPage = isset( $row['page'] ) ? intval( $row['page'] ) : null;
@@ -396,7 +387,6 @@
397388 $this->mDeleted = isset( $row['deleted'] ) ? intval( $row['deleted'] ) : 0;
398389 $this->mSize = isset( $row['len'] ) ? intval( $row['len'] ) : null;
399390 $this->mParentId = isset( $row['parent_id'] ) ? intval( $row['parent_id'] ) : null;
400 - $this->mSha1 = isset( $row['sha1'] ) ? strval( $row['sha1'] ) : null;
401391
402392 // Enforce spacing trimming on supplied text
403393 $this->mComment = isset( $row['comment'] ) ? trim( strval( $row['comment'] ) ) : null;
@@ -405,14 +395,9 @@
406396
407397 $this->mTitle = null; # Load on demand if needed
408398 $this->mCurrent = false;
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 - }
 399+ # If we still have no len_size, see it we have the text to figure it out
 400+ if ( !$this->mSize )
 401+ $this->mSize = is_null( $this->mText ) ? null : strlen( $this->mText );
417402 } else {
418403 throw new MWException( 'Revision constructor passed invalid row format.' );
419404 }
@@ -456,15 +441,6 @@
457442 }
458443
459444 /**
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 - /**
469445 * Returns the title of the page associated with this entry.
470446 *
471447 * @return Title
@@ -923,12 +899,8 @@
924900 'rev_timestamp' => $dbw->timestamp( $this->mTimestamp ),
925901 'rev_deleted' => $this->mDeleted,
926902 'rev_len' => $this->mSize,
927 - 'rev_parent_id' => is_null( $this->mParentId )
928 - ? $this->getPreviousRevisionId( $dbw )
929 - : $this->mParentId,
930 - 'rev_sha1' => is_null( $this->mSha1 )
931 - ? Revision::base36Sha1( $this->mText )
932 - : $this->mSha1
 903+ 'rev_parent_id' => is_null($this->mParentId) ?
 904+ $this->getPreviousRevisionId( $dbw ) : $this->mParentId
933905 ), __METHOD__
934906 );
935907
@@ -941,15 +913,6 @@
942914 }
943915
944916 /**
945 - * Get the base 36 SHA-1 value for a string of text
946 - * @param $text String
947 - * @return String
948 - */
949 - public static function base36Sha1( $text ) {
950 - return wfBaseConvert( sha1( $text ), 16, 36, 31 );
951 - }
952 -
953 - /**
954917 * Lazy-load the revision's text.
955918 * Currently hardcoded to the 'text' table storage engine.
956919 *
Index: trunk/phase3/includes/WikiPage.php
@@ -1662,8 +1662,7 @@
16631663 'ar_flags' => '\'\'', // MySQL's "strict mode"...
16641664 'ar_len' => 'rev_len',
16651665 'ar_page_id' => 'page_id',
1666 - 'ar_deleted' => $bitfield,
1667 - 'ar_sha1' => 'rev_sha1'
 1666+ 'ar_deleted' => $bitfield
16681667 ), array(
16691668 'page_id' => $id,
16701669 'page_id = rev_page'
Index: trunk/phase3/includes/specials/SpecialUndelete.php
@@ -124,7 +124,7 @@
125125 $res = $dbr->select( 'archive',
126126 array(
127127 'ar_minor_edit', 'ar_timestamp', 'ar_user', 'ar_user_text',
128 - 'ar_comment', 'ar_len', 'ar_deleted', 'ar_rev_id', 'ar_sha1'
 128+ 'ar_comment', 'ar_len', 'ar_deleted', 'ar_rev_id'
129129 ),
130130 array( 'ar_namespace' => $this->title->getNamespace(),
131131 'ar_title' => $this->title->getDBkey() ),
@@ -464,8 +464,7 @@
465465 'ar_text_id',
466466 'ar_deleted',
467467 'ar_page_id',
468 - 'ar_len',
469 - 'ar_sha1' ),
 468+ 'ar_len' ),
470469 /* WHERE */ array(
471470 'ar_namespace' => $this->title->getNamespace(),
472471 'ar_title' => $this->title->getDBkey(),

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r94289* Added rev_sha1 and ar_sha1 columns to revision/archive tables (useful for b......aaron21:52, 11 August 2011
r94290Follow-up r94289: code changes to fill the new fields on insertion and select...aaron21:54, 11 August 2011
r94364* Added Revision::getSha1 function...aaron17:29, 12 August 2011
r94541Revert r94289, r94290, r94294, r94333, r94345, r94362, r94370 -- core schema ...brion18:24, 15 August 2011

Status & tagging log