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