dépôts
/
lhc
/
web
/
wiklou.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge "Log when User::saveSettings is called in read-only mode"
[lhc/web/wiklou.git]
/
maintenance
/
createAndPromote.php
diff --git
a/maintenance/createAndPromote.php
b/maintenance/createAndPromote.php
index
03e6904
..
79f7254
100644
(file)
--- a/
maintenance/createAndPromote.php
+++ b/
maintenance/createAndPromote.php
@@
-1,6
+1,6
@@
<?php
/**
<?php
/**
- * Creates an account and grant
it administrator
rights.
+ * Creates an account and grant
s it
rights.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@
-26,18
+26,20
@@
require_once __DIR__ . '/Maintenance.php';
/**
require_once __DIR__ . '/Maintenance.php';
/**
- * Maintenance script to create an account and grant it
administrator
rights.
+ * Maintenance script to create an account and grant it rights.
*
* @ingroup Maintenance
*/
class CreateAndPromote extends Maintenance {
*
* @ingroup Maintenance
*/
class CreateAndPromote extends Maintenance {
-
- static $permitRoles = array( 'sysop', 'bureaucrat' );
+ 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";
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" );
}
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();
}
$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" );
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";
return;
} elseif ( count( $promotions ) !== 0 ) {
$promoText = "User:{$username} into " . implode( ', ', $promotions ) . "...\n";