revert r102636
[lhc/web/wiklou.git] / maintenance / protect.php
index e97fc10..c304396 100644 (file)
@@ -1,5 +1,7 @@
 <?php
 /**
+ * Protect or unprotect an article.
+ *
  * 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
  * the Free Software Foundation; either version 2 of the License, or
@@ -45,6 +47,10 @@ class Protect extends Maintenance {
                }
 
                $wgUser = User::newFromName( $userName );
+               if ( !$wgUser ) {
+                       $this->error( "Invalid username", true );
+               }
+               
                $restrictions = array( 'edit' => $protection, 'move' => $protection );
 
                $t = Title::newFromText( $this->getArg() );
@@ -66,4 +72,4 @@ class Protect extends Maintenance {
 }
 
 $maintClass = "Protect";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );