2 require( './commandLine.inc' );
4 // Do each user sequentially, since accounts can't be deleted
6 print "Beginning batch conversion of user options.\n";
9 $dbw = wfGetDB( DB_MASTER
);
12 while ($id !== null) {
13 $idCond = 'user_id>'.$dbw->addQuotes( $id );
14 $optCond = "user_options!=".$dbw->addQuotes( '' ); // For compatibility
15 $res = $dbw->select( 'user', '*',
16 array( $optCond, $idCond ), __METHOD__
,
17 array( 'LIMIT' => 50, 'FOR UPDATE' ) );
18 $id = convertOptionBatch( $res, $dbw );
24 print "--Converted to ID $id\n";
26 print "Conversion done. Converted $conversionCount user records.\n";
28 function convertOptionBatch( $res, $dbw ) {
30 while ($row = $dbw->fetchObject( $res ) ) {
31 global $conversionCount;
34 $u = User
::newFromRow( $row );