From bc0b47fa05e25c1c2bb8e147d6bfaf4156a69944 Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Thu, 5 Jan 2006 23:16:11 +0000 Subject: [PATCH] * use the $option system * add '--help' (and die after showing the message) * clean up parameter handling a bit --- maintenance/removeUnusedAccounts.php | 39 ++++++++++++++++++---------- 1 file changed, 26 insertions(+), 13 deletions(-) diff --git a/maintenance/removeUnusedAccounts.php b/maintenance/removeUnusedAccounts.php index 038875f4d9..a3a893835b 100644 --- a/maintenance/removeUnusedAccounts.php +++ b/maintenance/removeUnusedAccounts.php @@ -8,22 +8,33 @@ * @subpackage Maintenance * @author Rob Church */ + +# Options available +$options = array( 'delete','help' ); require_once( 'commandLine.inc' ); require_once( 'removeUnusedAccounts.inc' ); -echo( "REMOVE UNUSED ACCOUNTS\nThis script will delete all users who have made no edits.\n\n" ); -echo( "Syntax: removeUnusedAccounts.php [delete]\n * delete -> delete the accounts\n * The first user (usually the site owner) is left alone\n\n" ); + +# Default action (just report): +$action = ACTION_REPORT; # Handle parameters -if( isset( $args[0] ) ) { - $param = array_shift( $args ); - if( $param == 'delete' ) { - $action = ACTION_DELETE; - } else { - $action = ACTION_REPORT; - } -} else { - $action = ACTION_REPORT; +if(@$options['help']) { +echo << 0 ) ) { echo( " Deleting..." ); DeleteUsers( $del ); echo( "done.\n" ); +} else { + echo "\nYou can delete them by using the '--delete' switch (see help).\n"; } -?> \ No newline at end of file +?> -- 2.20.1