Index: trunk/extensions/Renameuser/SpecialRenameuser_body.php |
— | — | @@ -331,18 +331,23 @@ |
332 | 332 | 'image' => 'img_user_text', |
333 | 333 | 'oldimage' => 'oi_user_text', |
334 | 334 | 'archive' => 'ar_user_text', |
335 | | - 'revision' => 'rev_user_text' |
| 335 | + // FIXME: 'filearchive' => 'fa_user_text' |
336 | 336 | ); |
337 | 337 | $this->tablesJob = array(); |
338 | 338 | // See if this is for large tables on large, busy, wikis |
339 | 339 | if( function_exists('wfQueriesMustScale') && wfQueriesMustScale() ) { |
340 | | - #$this->tablesJob['revision'] = array('rev_user_text','rev_id'); |
| 340 | + // For users with many edits, be nice to servers |
| 341 | + if( User::edits( $this->uid ) > RENAMEUSER_CONTRIBJOB ) { |
| 342 | + $this->tablesJob['revision'] = array('rev_user_text','rev_id'); |
| 343 | + } else { |
| 344 | + $this->tables['revision'] = 'rev_user_text'; |
| 345 | + } |
| 346 | + // Recent changes is pretty hot, deadlocks occur if done all at once |
341 | 347 | $this->tablesJob['recentchanges'] = array('rc_user_text','rc_id'); |
342 | 348 | } else { |
343 | | - #$this->tables['revision'] = 'rev_user_text'; |
344 | 349 | $this->tables['recentchanges'] = 'rc_user_text'; |
| 350 | + $this->tables['revision'] = 'rev_user_text'; |
345 | 351 | } |
346 | | - |
347 | 352 | } |
348 | 353 | |
349 | 354 | /** |
— | — | @@ -353,7 +358,7 @@ |
354 | 359 | |
355 | 360 | wfProfileIn( __METHOD__ ); |
356 | 361 | |
357 | | - $dbw =& wfGetDB( DB_MASTER ); |
| 362 | + $dbw = wfGetDB( DB_MASTER ); |
358 | 363 | // Rename and touch the user before re-attributing edits, |
359 | 364 | // this avoids users still being logged in and making new edits while |
360 | 365 | // being renamed, which leaves edits at the old name. |
— | — | @@ -384,15 +389,14 @@ |
385 | 390 | array( $field => $this->new ), |
386 | 391 | array( $field => $this->old ), |
387 | 392 | __METHOD__ |
388 | | - #,array( $dbw->lowPriorityOption() ) |
389 | 393 | ); |
390 | 394 | } |
391 | 395 | |
392 | 396 | foreach( $this->tablesJob as $table => $params ) { |
393 | 397 | $res = $dbw->select( $table, |
394 | | - array( $params[0], $params[1] ), |
395 | | - array( $params[0] => $this->old ) |
396 | | - ); |
| 398 | + array( $params[0], $params[1] ), |
| 399 | + array( $params[0] => $this->old ) |
| 400 | + ); |
397 | 401 | |
398 | 402 | global $wgUpdateRowsPerJob; |
399 | 403 | |
— | — | @@ -402,8 +406,8 @@ |
403 | 407 | $key = $params[1]; |
404 | 408 | $jobParams = array(); |
405 | 409 | $jobParams['table'] = $table; |
406 | | - $jobParams['column'] = $params[0]; |
407 | | - $jobParams['uniqueKey'] = $key; |
| 410 | + $jobParams['column'] = $params[0]; // some *_user_text column |
| 411 | + $jobParams['uniqueKey'] = $key; // doesn't *have* to be unique |
408 | 412 | $jobParams['oldname'] = $this->old; |
409 | 413 | $jobParams['newname'] = $this->new; |
410 | 414 | |
Index: trunk/extensions/Renameuser/SpecialRenameuser.php |
— | — | @@ -32,8 +32,8 @@ |
33 | 33 | * The maximum number of edits a user can have and still be allowed renaming, |
34 | 34 | * set it to 0 to disable the limit. |
35 | 35 | */ |
36 | | -//define( 'RENAMEUSER_CONTRIBLIMIT', 6800 ); |
37 | 36 | define( 'RENAMEUSER_CONTRIBLIMIT', 200000 ); |
| 37 | +define( 'RENAMEUSER_CONTRIBJOB', 50000 ); |
38 | 38 | |
39 | 39 | # Add a new log type |
40 | 40 | global $wgLogTypes, $wgLogNames, $wgLogHeaders, $wgLogActions; |