r22807 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r22806‎ | r22807 | r22808 >
Date:03:07, 7 June 2007
Author:aaron
Status:old
Tags:
Comment:
*Only use rev_len, don't try to get text directly (brion pointed out issues when compressed). I don't want to clutter up the script loading Revision.php and call a bunch of methods for these two little fields either.
Modified paths:
  • /trunk/phase3/maintenance/rebuildrecentchanges.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/rebuildrecentchanges.inc
@@ -64,19 +64,17 @@
6565 # Switch! Look up the previous last edit, if any
6666 $lastCurId = intval( $obj->rc_cur_id );
6767 $emit = $obj->rc_timestamp;
68 - $sql2 = "SELECT rev_id, rev_len, rev_text_id FROM $revision " .
 68+ $sql2 = "SELECT rev_id, rev_len FROM $revision " .
6969 "WHERE rev_page={$lastCurId} ".
7070 "AND rev_timestamp<'{$emit}' ORDER BY rev_timestamp DESC LIMIT 1";
7171 $res2 = $dbw->query( $sql2 );
7272 if( $row = $dbw->fetchObject( $res2 ) ) {
7373 $lastOldId = intval( $row->rev_id );
74 - $lastTextId = intval( $row->rev_text_id );
7574 $lastSize = $row->rev_len; # Grab the last text size
7675 } else {
7776 # No previous edit
7877 $lastOldId = 0;
79 - $lastTextId = 0;
80 - $lastSize = NULL;
 78+ $lastSize = 'NULL';
8179 $new = 1;
8280 }
8381 $dbw->freeResult( $res2 );
@@ -84,25 +82,9 @@
8583 if( $lastCurId == 0 ) {
8684 print "Uhhh, something wrong? No curid\n";
8785 } else {
88 - # Check the text if not in rev_len for the last entry's text size
89 - if( !$lastSize ) {
90 - $lastText = $dbw->selectField( 'text', 'old_text', array('old_id' => $lastTextId ) );
91 - $lastSize = $lastText ? strlen($lastText) : 'NULL';
92 - }
9386 # Grab the entry's text size
94 - $res3 = $dbw->select( 'revision', array('rev_len','rev_text_id'), array('rev_id' => $obj->rc_this_oldid ) );
95 - if( $row = $dbw->fetchObject( $res3 ) ) {
96 - $textId = $row->rev_text_id;
97 - $size = $row->rev_len;
98 - } else {
99 - $textId = 0;
100 - $size = NULL;
101 - }
102 - # Check the text if not in rev_len for the entry's text size
103 - if( !$size ) {
104 - $text = $dbw->selectField( 'text', 'old_text', array('old_id' => $textId ) );
105 - $size = $text ? strlen($text) : 'NULL';
106 - }
 87+ $size = $dbw->selectField( 'revision', 'rev_len', array('rev_id' => $obj->rc_this_oldid ) );
 88+ $size = $size ? $size : 'NULL';
10789
10890 $sql3 = "UPDATE $recentchanges SET rc_last_oldid=$lastOldId,rc_new=$new,rc_type=$new," .
10991 "rc_old_len='$lastSize',rc_new_len='$size' " .

Follow-up revisions

RevisionCommit summaryAuthorDate
r22811Merged revisions 22791-22810 via svnmerge from...david07:26, 7 June 2007

Status & tagging log