Index: trunk/phase3/maintenance/protect.php |
— | — | @@ -28,10 +28,11 @@ |
29 | 29 | $this->addOption( 'semiprotect', 'Adds semi-protection' ); |
30 | 30 | $this->addOption( 'u', 'Username to protect with', false, true ); |
31 | 31 | $this->addOption( 'r', 'Reason for un/protection', false, true ); |
| 32 | + $this->addArg( 'title', 'Title to protect', true ); |
32 | 33 | } |
33 | 34 | |
34 | 35 | public function execute() { |
35 | | - global $wgUser, $wgTitle, $wgArticle; |
| 36 | + global $wgUser; |
36 | 37 | |
37 | 38 | $userName = $this->getOption( 'u', 'Maintenance script' ); |
38 | 39 | $reason = $this->getOption( 'r', '' ); |
— | — | @@ -46,16 +47,16 @@ |
47 | 48 | $wgUser = User::newFromName( $userName ); |
48 | 49 | $restrictions = array( 'edit' => $protection, 'move' => $protection ); |
49 | 50 | |
50 | | - $wgTitle = Title::newFromText( $this->getArg() ); |
51 | | - if ( !$wgTitle ) { |
| 51 | + $t = Title::newFromText( $this->getArg() ); |
| 52 | + if ( !$t ) { |
52 | 53 | $this->error( "Invalid title", true ); |
53 | 54 | } |
54 | 55 | |
55 | | - $wgArticle = new Article( $wgTitle ); |
| 56 | + $article = new Article( $t ); |
56 | 57 | |
57 | 58 | # un/protect the article |
58 | 59 | $this->output( "Updating protection status... " ); |
59 | | - $success = $wgArticle->updateRestrictions( $restrictions, $reason ); |
| 60 | + $success = $article->updateRestrictions( $restrictions, $reason ); |
60 | 61 | if ( $success ) { |
61 | 62 | $this->output( "done\n" ); |
62 | 63 | } else { |