r77778 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r77777‎ | r77778 | r77779 >
Date:05:59, 5 December 2010
Author:demon
Status:resolved (Comments)
Tags:
Comment:
One less $wgTitle, and use dbw->update() instead of raw sql
Modified paths:
  • /trunk/phase3/maintenance/rebuildrecentchanges.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/rebuildrecentchanges.php
@@ -31,8 +31,6 @@
3232 }
3333
3434 public function execute() {
35 - global $wgTitle;
36 - $wgTitle = Title::newFromText( "Rebuild recent changes script" );
3735 $this->rebuildRecentChangesTablePass1();
3836 $this->rebuildRecentChangesTablePass2();
3937 $this->rebuildRecentChangesTablePass3();
@@ -137,10 +135,16 @@
138136 $size = $dbw->selectField( 'revision', 'rev_len', array( 'rev_id' => $obj->rc_this_oldid ) );
139137 $size = !is_null( $size ) ? intval( $size ) : 'NULL';
140138
141 - $sql3 = "UPDATE $recentchanges SET rc_last_oldid=$lastOldId,rc_new=$new,rc_type=$new," .
142 - "rc_old_len=$lastSize,rc_new_len=$size " .
143 - "WHERE rc_cur_id={$lastCurId} AND rc_this_oldid={$obj->rc_this_oldid}";
144 - $dbw->query( $sql3 );
 139+ $dbw->update( 'recentchanges',
 140+ array(
 141+ 'rc_old_len' => $lastSize,
 142+ 'rc_new_len' => $size,
 143+ ), array(
 144+ 'rc_cur_id' => $lastCurId,
 145+ 'rc_this_oldid' => $obj->rc_this_oldid,
 146+ ),
 147+ __METHOD__
 148+ );
145149
146150 $lastOldId = intval( $obj->rc_this_oldid );
147151 $lastSize = $size;

Follow-up revisions

RevisionCommit summaryAuthorDate
r77822Fix copy+paste error from r77778demon19:34, 5 December 2010
r97544* (bug 31007) Fix regression in rebuildrecentchanges maintenance script...brion20:00, 19 September 2011
r97545MFT r97544: fix bug 31007 regression in r77778brion20:02, 19 September 2011
r97546MFT r97544: fix bug 31007 regression in r77778brion20:02, 19 September 2011

Comments

#Comment by Nikerabbit (talk | contribs)   09:50, 5 December 2010

You didn't mention what happened to rc_last_oldid and rc_new and rc_type.

#Comment by Catrope (talk | contribs)   10:21, 5 December 2010

That looks like a bug. Setting fixme.

#Comment by Brion VIBBER (talk | contribs)   19:53, 19 September 2011

Causes bug 31007 -- tries to pass literal string 'NULL' in for null values of rc_old_len / rc_new_len, throws errors on PostgreSQL. Leftover code from before this rev is still trying to build partial raw SQL.

#Comment by Brion VIBBER (talk | contribs)   20:04, 19 September 2011

Fixed in r97544, merged to 1.18 & 1.17 release branches.

Status & tagging log