Index: trunk/extensions/Makebot/migrateBotlog.php |
— | — | @@ -27,28 +27,36 @@ |
28 | 28 | // Determining what groups the account was in before the change |
29 | 29 | // would be difficult and unnecessary 99.9% of the time, so we just |
30 | 30 | // assume the account was in no other groups |
31 | | - $params = array( 'grant' => "\nbot", |
32 | | - 'revoke' => "bot\n" |
33 | | - ); |
| 31 | + $params = array( 'grant' => "\nbot", 'revoke' => "bot\n" ); |
34 | 32 | |
35 | 33 | $logrows = $dbw->select( 'logging', |
36 | 34 | array( 'log_id', 'log_action' ), |
37 | | - array( 'log_type' => 'makebot' ), |
| 35 | + array( 'log_type' => 'makebot', |
| 36 | + 'log_action' => array('grant','revoke') ), // sanity check |
38 | 37 | __METHOD__ |
39 | 38 | ); |
40 | 39 | $count = $logrows->numRows(); |
41 | 40 | $this->output( "Updating $count entries in the logging table\n" ); |
| 41 | + |
| 42 | + $batch = 0; |
42 | 43 | foreach ( $logrows as $row ) { |
43 | 44 | $dbw->update( 'logging', |
44 | | - array( 'log_action' => 'rights', 'log_type'=>'rights', 'log_params' => $params[$row->log_action] ), |
| 45 | + array( 'log_action' => 'rights', 'log_type'=>'rights', |
| 46 | + 'log_params' => $params[$row->log_action] ), |
45 | 47 | array( 'log_id' => $row->log_id ), |
46 | 48 | __METHOD__ |
47 | 49 | ); |
| 50 | + $batch++; |
| 51 | + if( $batch == 100 ) { |
| 52 | + wfWaitForSlaves( 5 ); |
| 53 | + $batch = 0; |
| 54 | + } |
48 | 55 | } |
49 | 56 | |
50 | 57 | $rcrows = $dbw->select( 'recentchanges', |
51 | 58 | array( 'rc_id', 'rc_log_action' ), |
52 | | - array( 'rc_log_type' => 'makebot' ), |
| 59 | + array( 'rc_log_type' => 'makebot', |
| 60 | + 'rc_log_action' => array('grant','revoke') ), // sanity check |
53 | 61 | __METHOD__ |
54 | 62 | ); |
55 | 63 | $count = $rcrows->numRows(); |
— | — | @@ -59,7 +67,8 @@ |
60 | 68 | array( 'rc_id' => $row->rc_id ), |
61 | 69 | __METHOD__ |
62 | 70 | ); |
63 | | - } |
| 71 | + } |
| 72 | + $this->output( "Done!\n" ); |
64 | 73 | } |
65 | 74 | } |
66 | 75 | |