diff tmpwiki/maintenance/removeUnusedAccounts.inc wiki/maintenance/removeUnusedAccounts.inc
40a41,42
> 	echo( "Sysops and bureaucrats will be ignored.\n\n" );
> 	echo( "Accounts touched within the last week will be ignored.\n\n" );
diff tmpwiki/maintenance/removeUnusedAccounts.php wiki/maintenance/removeUnusedAccounts.php
11,14d10
< /**
<  * @todo Don't delete sysops or bureaucrats
<  */
< 
30c26,27
< $res = $dbr->select( 'user', array( 'user_id', 'user_name' ), '', $fname );
---
> $res = $dbr->select( 'user', array( 'user_id', 'user_name', 'user_touched' ), '', $fname );
> $excludedGroups = array( 'sysop', 'bureaucrat' );
32,33c29,31
< 	# Check the account, but ignore it if it's the primary administrator
< 	if( $row->user_id > 1 && isInactiveAccount( $row->user_id, true ) ) {
---
> 	# Check the account, but ignore it if it's within the "sysop" or "bureaucrat" group.
> 	$instance = User::newFromId( $row->user_id );
> 	if( count( array_intersect( $instance->getGroups(), $excludedGroups ) ) == 0 && isInactiveAccount( $row->user_id, true ) && wfTimestamp( TS_UNIX, $row->user_touched ) < wfTimestamp( TS_UNIX, time() - 604800 ) ) {
