X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2Fprotect.php;h=449a7ad6f0bf9812616881417398002147ec81de;hb=39fe0565d0cc6706868ad3e9b46509e82bcd593e;hp=ec03f9349d59f8cced297268d5fd47c1603408d7;hpb=f0a00a49b1be46b51aeef712f363305bce4448fa;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/protect.php b/maintenance/protect.php index ec03f9349d..449a7ad6f0 100644 --- a/maintenance/protect.php +++ b/maintenance/protect.php @@ -41,7 +41,7 @@ class Protect extends Maintenance { } public function execute() { - $userName = $this->getOption( 'u', 'Maintenance script' ); + $userName = $this->getOption( 'u', false ); $reason = $this->getOption( 'r', '' ); $cascade = $this->hasOption( 'cascade' ); @@ -53,7 +53,11 @@ class Protect extends Maintenance { $protection = ""; } - $user = User::newFromName( $userName ); + if ( $userName === false ) { + $user = User::newSystemUser( 'Maintenance script', array( 'steal' => true ) ); + } else { + $user = User::newFromName( $userName ); + } if ( !$user ) { $this->error( "Invalid username", true ); }