r38309 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r38308‎ | r38309 | r38310 >
Date:16:48, 31 July 2008
Author:greg
Status:old
Tags:
Comment:
Remove odd WHERE clause condition and standardize DB call, per bug 14989.
Modified paths:
  • /trunk/extensions/AntiSpoof/batchAntiSpoof.php (modified) (history)

Diff [purge]

Index: trunk/extensions/AntiSpoof/batchAntiSpoof.php
@@ -5,15 +5,15 @@
66 $base = dirname( dirname( dirname( __FILE__ ) ) );
77 require $base . '/maintenance/commandLine.inc';
88
9 -// fixme
10 -$dbr = new Database( $wgDBserver, $wgDBuser, $wgDBpassword, $wgDBname );
11 -$dbr->bufferResults( false );
 9+$dbw = wfGetDB( DB_MASTER );
1210
 11+$dbw->bufferResults( false );
 12+
1313 $batchSize = 1000;
1414
15 -$result = $dbr->select( 'user', 'user_name', '1', 'batchAntiSpoof.php' );
 15+$result = $dbw->select( 'user', 'user_name', null, 'batchAntiSpoof.php' );
1616 $n = 0;
17 -while( $row = $dbr->fetchObject( $result ) ) {
 17+while( $row = $dbw->fetchObject( $result ) ) {
1818 if( $n++ % $batchSize == 0 ) {
1919 echo "$wgDBname $n\n";
2020 }
@@ -25,6 +25,8 @@
2626 $items = array();
2727 }
2828 }
 29+
2930 SpoofUser::batchRecord( $items );
3031 echo "$wgDBname $n done.\n";
31 -$dbr->freeResult( $result );
 32+$dbw->freeResult( $result );
 33+

Status & tagging log