Index: trunk/extensions/AntiSpoof/batchAntiSpoof.php |
— | — | @@ -5,15 +5,15 @@ |
6 | 6 | $base = dirname( dirname( dirname( __FILE__ ) ) ); |
7 | 7 | require $base . '/maintenance/commandLine.inc'; |
8 | 8 | |
9 | | -// fixme |
10 | | -$dbr = new Database( $wgDBserver, $wgDBuser, $wgDBpassword, $wgDBname ); |
11 | | -$dbr->bufferResults( false ); |
| 9 | +$dbw = wfGetDB( DB_MASTER ); |
12 | 10 | |
| 11 | +$dbw->bufferResults( false ); |
| 12 | + |
13 | 13 | $batchSize = 1000; |
14 | 14 | |
15 | | -$result = $dbr->select( 'user', 'user_name', '1', 'batchAntiSpoof.php' ); |
| 15 | +$result = $dbw->select( 'user', 'user_name', null, 'batchAntiSpoof.php' ); |
16 | 16 | $n = 0; |
17 | | -while( $row = $dbr->fetchObject( $result ) ) { |
| 17 | +while( $row = $dbw->fetchObject( $result ) ) { |
18 | 18 | if( $n++ % $batchSize == 0 ) { |
19 | 19 | echo "$wgDBname $n\n"; |
20 | 20 | } |
— | — | @@ -25,6 +25,8 @@ |
26 | 26 | $items = array(); |
27 | 27 | } |
28 | 28 | } |
| 29 | + |
29 | 30 | SpoofUser::batchRecord( $items ); |
30 | 31 | echo "$wgDBname $n done.\n"; |
31 | | -$dbr->freeResult( $result ); |
| 32 | +$dbw->freeResult( $result ); |
| 33 | + |