diff tmpwiki/maintenance/removeUnusedAccounts.inc wiki/maintenance/removeUnusedAccounts.inc
41,42d40
< 	echo( "Accounts touched within the last week will be ignored.\n\n" );
< 	echo( "Sysops and bureaucrats will be ignored.\n\n" );
44c42,44
< 	echo( "  --delete : Delete accounts which are discovered to be inactive\n" );
---
> 	echo( "  --delete             : Delete accounts which are discovered to be inactive\n" );
> 	echo( "  --ignore-touched=x   : Ignore accounts touched within the lasts x days\n" );
> 	echo( "  --ignore-groups=x,y  : Ignore accounts within these groups\n" );
diff tmpwiki/maintenance/removeUnusedAccounts.php wiki/maintenance/removeUnusedAccounts.php
11d10
< 
28c27,41
< $excludedGroups = array( 'sysop', 'bureaucrat' );
---
> if( isset( $options['ignore-groups'] ) ) {
> 	$excludedGroups = explode( ',', $options['ignore-groups'] );
> } else { $excludedGroups = array(); }
> $touchedSeconds = 0;
> if( isset( $options['ignore-touched'] ) ) {
> 	$touchedParamError = 0;
> 	if( ctype_digit( $options['ignore-touched'] ) ) {
> 		if( $options['ignore-touched'] <= 0 ) {
> 			$touchedParamError = 1;
> 		}
> 	} else { $touchedParamError = 1; }
> 	if( $touchedParamError == 1 ) {
> 		die( "Please put a valid positive integer on the --ignore-touched parameter.\n" );
> 	} else { $touchedSeconds = 86400 * $options['ignore-touched']; }
> }
30c43
< 	# Check the account, but ignore it if it's within the "sysop" or "bureaucrat" group.
---
> 	# Check the account, but ignore it if it's within a $excludedGroups group or if it's touched within the $touchedSeconds seconds.
32,34c45,47
< 	if( count( array_intersect( $instance->getGroups(), $excludedGroups ) ) == 0
< 		&& isInactiveAccount( $row->user_id, true ) 
< 		&& wfTimestamp( TS_UNIX, $row->user_touched ) < wfTimestamp( TS_UNIX, time() - 604800 ) 
---
> 	if( count( array_intersect( $instance->getEffectiveGroups(), $excludedGroups ) ) == 0
> 		&& isInactiveAccount( $row->user_id, true )
> 		&& wfTimestamp( TS_UNIX, $row->user_touched ) < wfTimestamp( TS_UNIX, time() - $touchedSeconds )
