summaryrefslogtreecommitdiff
path: root/maintenance/createAndPromote.php
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-05-01 15:32:59 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-05-01 15:32:59 -0400
commit6dc1997577fab2c366781fd7048144935afa0012 (patch)
tree8918d28c7ab4342f0738985e37af1dfc42d0e93a /maintenance/createAndPromote.php
parent150f94f051128f367bc89f6b7e5f57eb2a69fc62 (diff)
parentfa89acd685cb09cdbe1c64cbb721ec64975bbbc1 (diff)
Merge commit 'fa89acd'
# Conflicts: # .gitignore # extensions/ArchInterWiki.sql
Diffstat (limited to 'maintenance/createAndPromote.php')
-rw-r--r--maintenance/createAndPromote.php21
1 files changed, 20 insertions, 1 deletions
diff --git a/maintenance/createAndPromote.php b/maintenance/createAndPromote.php
index 79f72542..861b364b 100644
--- a/maintenance/createAndPromote.php
+++ b/maintenance/createAndPromote.php
@@ -43,6 +43,14 @@ class CreateAndPromote extends Maintenance {
foreach ( self::$permitRoles as $role ) {
$this->addOption( $role, "Add the account to the {$role} group" );
}
+
+ $this->addOption(
+ 'custom-groups',
+ 'Comma-separated list of groups to add the user to',
+ false,
+ true
+ );
+
$this->addArg( "username", "Username of new user" );
$this->addArg( "password", "Password to set (not required if --force is used)", false );
}
@@ -69,8 +77,19 @@ class CreateAndPromote extends Maintenance {
$inGroups = $user->getGroups();
}
+ $groups = array_filter( self::$permitRoles, array( $this, 'hasOption' ) );
+ if ( $this->hasOption( 'custom-groups' ) ) {
+ $customGroupsText = $this->getOption( 'custom-groups' );
+ if ( $customGroupsText !== '' ) {
+ $customGroups = explode( ',', $customGroupsText );
+ foreach ( $customGroups as $customGroup ) {
+ $groups[] = trim( $customGroup );
+ }
+ }
+ }
+
$promotions = array_diff(
- array_filter( self::$permitRoles, array( $this, 'hasOption' ) ),
+ $groups,
$inGroups
);