Remove unused parameter
[mediawiki.git] / maintenance / reassignEdits.php
blob0d64020280dd6cc7bc830704b5d4e5fe5c8bcef8
1 <?php
3 /**
4 * Reassign edits from a user or IP address to another user
6 * @file
7 * @ingroup Maintenance
8 * @author Rob Church <robchur@gmail.com>
9 * @licence GNU General Public Licence 2.0 or later
12 $options = array( 'force', 'norc', 'quiet', 'report' );
13 require_once( 'commandLine.inc' );
14 require_once( 'reassignEdits.inc.php' );
16 # Set silent mode; --report overrides --quiet
17 if( !@$options['report'] && @$options['quiet'] )
18 setSilent();
20 out( "Reassign Edits\n\n" );
22 if( @$args[0] && @$args[1] ) {
24 # Set up the users involved
25 $from =& initialiseUser( $args[0] );
26 $to =& initialiseUser( $args[1] );
28 # If the target doesn't exist, and --force is not set, stop here
29 if( $to->getId() || @$options['force'] ) {
30 # Reassign the edits
31 $report = @$options['report'];
32 $count = reassignEdits( $from, $to, !@$options['norc'], $report );
33 # If reporting, and there were items, advise the user to run without --report
34 if( $report )
35 out( "Run the script again without --report to update.\n" );
36 } else {
37 $ton = $to->getName();
38 echo( "User '{$ton}' not found.\n" );
41 } else {
42 ShowUsage();
45 /** Show script usage information */
46 function ShowUsage() {
47 echo( "Reassign edits from one user to another.\n\n" );
48 echo( "Usage: php reassignEdits.php [--force|--quiet|--norc|--report] <from> <to>\n\n" );
49 echo( " <from> : Name of the user to assign edits from\n" );
50 echo( " <to> : Name of the user to assign edits to\n" );
51 echo( " --force : Reassign even if the target user doesn't exist\n" );
52 echo( " --quiet : Don't print status information (except for errors)\n" );
53 echo( " --norc : Don't update the recent changes table\n" );
54 echo( " --report : Print out details of what would be changed, but don't update it\n\n" );