00001 <?php
00002
00012 $options = array( 'force', 'norc', 'quiet', 'report' );
00013 require_once( 'commandLine.inc' );
00014 require_once( 'reassignEdits.inc.php' );
00015
00016 # Set silent mode; --report overrides --quiet
00017 if( !@$options['report'] && @$options['quiet'] )
00018 setSilent();
00019
00020 out( "Reassign Edits\n\n" );
00021
00022 if( @$args[0] && @$args[1] ) {
00023
00024 # Set up the users involved
00025 $from =& initialiseUser( $args[0] );
00026 $to =& initialiseUser( $args[1] );
00027
00028 # If the target doesn't exist, and --force is not set, stop here
00029 if( $to->getId() || @$options['force'] ) {
00030 # Reassign the edits
00031 $report = @$options['report'];
00032 $count = reassignEdits( $from, $to, !@$options['norc'], $report );
00033 # If reporting, and there were items, advise the user to run without --report
00034 if( $report )
00035 out( "Run the script again without --report to update.\n" );
00036 } else {
00037 $ton = $to->getName();
00038 echo( "User '{$ton}' not found.\n" );
00039 }
00040
00041 } else {
00042 ShowUsage();
00043 }
00044
00046 function ShowUsage() {
00047 echo( "Reassign edits from one user to another.\n\n" );
00048 echo( "Usage: php reassignEdits.php [--force|--quiet|--norc|--report] <from> <to>\n\n" );
00049 echo( " <from> : Name of the user to assign edits from\n" );
00050 echo( " <to> : Name of the user to assign edits to\n" );
00051 echo( " --force : Reassign even if the target user doesn't exist\n" );
00052 echo( " --quiet : Don't print status information (except for errors)\n" );
00053 echo( " --norc : Don't update the recent changes table\n" );
00054 echo( " --report : Print out details of what would be changed, but don't update it\n\n" );
00055 }
00056