X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FcreateAndPromote.php;h=861b364b68c09059d75969b9d72cda3048569a3b;hb=f2443895710882262ba672d42db17f1fe58983fd;hp=79f725426d23df768369f31e5c929d19cbbbb3c2;hpb=0ff2c62197fdaf79f82d8657afd70621725c9762;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/createAndPromote.php b/maintenance/createAndPromote.php index 79f725426d..861b364b68 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 );