X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FcreateAndPromote.php;h=79f725426d23df768369f31e5c929d19cbbbb3c2;hb=4b983308cbd54b5e2f90d4fe05a4110c84608bcc;hp=aa25ee602248c2881fa705bfee39778140c9ba72;hpb=d4eefca4dd645bbef2b435ef1228a141f6a48e67;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/createAndPromote.php b/maintenance/createAndPromote.php index aa25ee6022..79f725426d 100644 --- a/maintenance/createAndPromote.php +++ b/maintenance/createAndPromote.php @@ -31,13 +31,15 @@ require_once __DIR__ . '/Maintenance.php'; * @ingroup Maintenance */ class CreateAndPromote extends Maintenance { - - static $permitRoles = array( 'sysop', 'bureaucrat', 'bot' ); + private static $permitRoles = array( 'sysop', 'bureaucrat', 'bot' ); public function __construct() { parent::__construct(); $this->mDescription = "Create a new user account and/or grant it additional rights"; - $this->addOption( "force", "If acccount exists already, just grant it rights or change password." ); + $this->addOption( + 'force', + 'If acccount exists already, just grant it rights or change password.' + ); foreach ( self::$permitRoles as $role ) { $this->addOption( $role, "Add the account to the {$role} group" ); } @@ -67,10 +69,14 @@ class CreateAndPromote extends Maintenance { $inGroups = $user->getGroups(); } - $promotions = array_diff( array_filter( self::$permitRoles, array( $this, 'hasOption' ) ), $inGroups ); + $promotions = array_diff( + array_filter( self::$permitRoles, array( $this, 'hasOption' ) ), + $inGroups + ); if ( $exists && !$password && count( $promotions ) === 0 ) { $this->output( "Account exists and nothing to do.\n" ); + return; } elseif ( count( $promotions ) !== 0 ) { $promoText = "User:{$username} into " . implode( ', ', $promotions ) . "...\n";