r56904 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r56903‎ | r56904 | r56905 >
Date:22:55, 24 September 2009
Author:aaron
Status:deferred
Tags:
Comment:
* Added some sanity checks just in case
* Check slave lag
Modified paths:
  • /trunk/extensions/Makebot/migrateBotlog.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Makebot/migrateBotlog.php
@@ -27,28 +27,36 @@
2828 // Determining what groups the account was in before the change
2929 // would be difficult and unnecessary 99.9% of the time, so we just
3030 // 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" );
3432
3533 $logrows = $dbw->select( 'logging',
3634 array( 'log_id', 'log_action' ),
37 - array( 'log_type' => 'makebot' ),
 35+ array( 'log_type' => 'makebot',
 36+ 'log_action' => array('grant','revoke') ), // sanity check
3837 __METHOD__
3938 );
4039 $count = $logrows->numRows();
4140 $this->output( "Updating $count entries in the logging table\n" );
 41+
 42+ $batch = 0;
4243 foreach ( $logrows as $row ) {
4344 $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] ),
4547 array( 'log_id' => $row->log_id ),
4648 __METHOD__
4749 );
 50+ $batch++;
 51+ if( $batch == 100 ) {
 52+ wfWaitForSlaves( 5 );
 53+ $batch = 0;
 54+ }
4855 }
4956
5057 $rcrows = $dbw->select( 'recentchanges',
5158 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
5361 __METHOD__
5462 );
5563 $count = $rcrows->numRows();
@@ -59,7 +67,8 @@
6068 array( 'rc_id' => $row->rc_id ),
6169 __METHOD__
6270 );
63 - }
 71+ }
 72+ $this->output( "Done!\n" );
6473 }
6574 }
6675

Follow-up revisions

RevisionCommit summaryAuthorDate
r56905merged r56904aaron22:59, 24 September 2009

Status & tagging log