Index: trunk/extensions/Maintenance/Maintenance.php |
— | — | @@ -4,29 +4,41 @@ |
5 | 5 | * |
6 | 6 | * @file |
7 | 7 | * @ingroup Extensions |
8 | | - * @version 2.0.0 |
| 8 | + * @version 2.1.0 |
9 | 9 | * @author Ryan Schmidt |
10 | 10 | * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
11 | 11 | * @link http://www.mediawiki.org/wiki/Extension:Maintenance Documentation |
12 | 12 | */ |
13 | 13 | |
14 | 14 | if( !defined('MEDIAWIKI') ) { |
15 | | - echo("This file is an extension to the MediaWiki software and is not a valid access point"); |
16 | | - die(1); |
| 15 | + echo "This file is an extension to the MediaWiki software and is not a valid access point"; |
| 16 | + die( 1 ); |
17 | 17 | } |
18 | 18 | |
| 19 | +// !!!!!!!!! |
| 20 | +// BEGIN EXTENSION CONFIGURATION SECTION |
| 21 | +// !!!!!!!!! |
| 22 | + |
| 23 | +// Whether or not to show the "Output globals at the end of processing for debugging" checkbox |
| 24 | +// NOTE: enabling this can reveal system information such as environment variables |
| 25 | +$wgMaintenanceDebug = false; |
| 26 | + |
| 27 | +// !!!!!!!!! |
| 28 | +// END EXTENSION CONFIGURATION SECTION |
| 29 | +// !!!!!!!!! |
| 30 | + |
19 | 31 | // Extension credits that will show up on Special:Version |
20 | 32 | $wgExtensionCredits['specialpage'][] = array( |
21 | 33 | 'path' => __FILE__, |
22 | 34 | 'name' => 'Maintenance', |
23 | 35 | 'author' => 'Ryan Schmidt', |
24 | | - 'version' => '2.0.0', |
| 36 | + 'version' => '2.1.0', |
25 | 37 | 'descriptionmsg' => 'maintenance-desc', |
26 | 38 | 'url' => 'https://www.mediawiki.org/wiki/Extension:Maintenance', |
27 | 39 | ); |
28 | 40 | |
29 | 41 | // Set up the new special page |
30 | | -$dir = dirname(__FILE__) . '/'; |
| 42 | +$dir = dirname( __FILE__ ) . '/'; |
31 | 43 | $wgExtensionMessagesFiles['Maintenance'] = $dir . 'Maintenance.i18n.php'; |
32 | 44 | $wgExtensionMessagesFiles['MaintenanceAlias'] = $dir . 'Maintenance.alias.php'; |
33 | 45 | $wgAutoloadClasses['SpecialMaintenance'] = $dir . 'Maintenance_body.php'; |
Index: trunk/extensions/Maintenance/metadata.ini |
— | — | @@ -82,7 +82,15 @@ |
83 | 83 | enabled = 0 |
84 | 84 | |
85 | 85 | [cleanupSpam] |
86 | | -enabled = 0 |
| 86 | +arg = "hostname input" |
| 87 | +output[] = "found regex Found (.*) articles containing (.*)" |
| 88 | +output[] = "done string Done" |
| 89 | +output[] = "false string False match" |
| 90 | +output[] = "blanking string blanking" |
| 91 | +output[] = "reverting string reverting" |
| 92 | +output[] = "page regex (.*) \.\.\." |
| 93 | +error[] = "invalid regex Not a valid hostname specification: (.*)" |
| 94 | +error[] = "noid regex Internal error: no page for ID (.*)" |
87 | 95 | |
88 | 96 | [cleanupTitles] |
89 | 97 | enabled = 0 |
— | — | @@ -91,7 +99,8 @@ |
92 | 100 | enabled = 0 |
93 | 101 | |
94 | 102 | [clear_interwiki_cache] |
95 | | -enabled = 0 |
| 103 | +output[] = "db regex (.*)\.\.\." |
| 104 | +output[] = "done string done" |
96 | 105 | |
97 | 106 | [clear_stats] |
98 | 107 | enabled = 0 |
— | — | @@ -103,7 +112,14 @@ |
104 | 113 | enabled = 0 |
105 | 114 | |
106 | 115 | [createAndPromote] |
107 | | -enabled = 0 |
| 116 | +arg[] = "username input" |
| 117 | +arg[] = "password password" |
| 118 | +option = "bureaucrat check" |
| 119 | +output[] = "creating regex (.*): Creating and promoting User:(.*)\.\.\." |
| 120 | +output[] = "done string done." |
| 121 | +error[] = "invalid string invalid username." |
| 122 | +error[] = "exists string account exists." |
| 123 | +error[] = "password regex (.*)" |
108 | 124 | |
109 | 125 | [deleteArchivedFiles] |
110 | 126 | enabled = 0 |
Index: trunk/extensions/Maintenance/Maintenance_body.php |
— | — | @@ -94,7 +94,7 @@ |
95 | 95 | } |
96 | 96 | |
97 | 97 | private function makeForm( $type ) { |
98 | | - global $wgOut, $wgUser; |
| 98 | + global $wgOut, $wgUser, $wgMaintenanceDebug; |
99 | 99 | |
100 | 100 | $this->setHeaders(); |
101 | 101 | $wgOut->addHTML( $wgUser->getSkin()->makeKnownLinkObj( $this->getTitle(), wfMsgHtml( 'maintenance-backlink' ) ). '<br />' ); |
— | — | @@ -112,30 +112,32 @@ |
113 | 113 | foreach( $options as $option ) { |
114 | 114 | switch( $option['type'] ) { |
115 | 115 | case 'check': |
116 | | - $wgOut->addHTML( Xml::checkLabel( wfMsg( "maintenance-$type-option-" . $option['name'] ), 'wp' . ucfirst( $option['name'] ), 'wp' . ucfirst( $option['name'] ), $option['default'] ) . '<br /><br />' ); |
| 116 | + $wgOut->addHTML( Xml::checkLabel( wfMsg( "maintenance-$type-option-" . $option['name'] ), 'wp' . ucfirst( $option['name'] ), 'wp' . ucfirst( $option['name'] ), $option['default'] ) . '<br />' ); |
117 | 117 | break; |
118 | 118 | case 'input': |
119 | | - $wgOut->addHTML( Xml::inputLabel( wfMsg( "maintenance-$type-option-" . $option['name'] ), 'wp' . ucfirst( $option['name'] ), 'wp' . ucfirst( $option['name'] ), $option['size'], false, $option['attrib'] ) . '<br /><br />' ); |
| 119 | + $wgOut->addHTML( Xml::inputLabel( wfMsg( "maintenance-$type-option-" . $option['name'] ), 'wp' . ucfirst( $option['name'] ), 'wp' . ucfirst( $option['name'] ), $option['size'], false, $option['attrib'] ) . '<br />' ); |
120 | 120 | break; |
121 | 121 | case 'password': |
122 | | - $wgOut->addHTML( Xml::inputLabel( wfMsg( "maintenance-$type-option-" . $option['name'] ), 'wp' . ucfirst( $option['name'] ), 'wp' . ucfirst( $option['name'] ), $option['size'], false, array( 'type' => 'password' ) + $option['attrib'] ) . '<br /><br />' ); |
| 122 | + $wgOut->addHTML( Xml::inputLabel( wfMsg( "maintenance-$type-option-" . $option['name'] ), 'wp' . ucfirst( $option['name'] ), 'wp' . ucfirst( $option['name'] ), $option['size'], false, array( 'type' => 'password' ) + $option['attrib'] ) . '<br />' ); |
123 | 123 | break; |
124 | 124 | case 'textarea': |
125 | | - $wgOut->addHTML( wfMsg( "maintenance-$type-option-" . $option['name'] ) . '<textarea name="wp' . ucfirst( $option['name'] ) . '" rows="25" cols="80"></textarea><br /><br />'); |
| 125 | + $wgOut->addHTML( wfMsg( "maintenance-$type-option-" . $option['name'] ) . '<textarea name="wp' . ucfirst( $option['name'] ) . '" rows="25" cols="80"></textarea><br />'); |
126 | 126 | break; |
127 | 127 | } |
128 | 128 | } |
129 | | - $wgOut->addHTML( Xml::checkLabel( wfMsg( 'maintenance-option-quiet' ), 'wpQuiet', 'wpQuiet' ) . '<br /><br />' ); |
130 | | - $wgOut->addHTML( Xml::checkLabel( wfMsg( 'maintenance-option-globals' ), 'wpGlobals', 'wpGlobals' ) . '<br /><br />' ); |
| 129 | + $wgOut->addHTML( Xml::checkLabel( wfMsg( 'maintenance-option-quiet' ), 'wpQuiet', 'wpQuiet' ) . '<br />' ); |
| 130 | + if( $wgMaintenanceDebug ) { |
| 131 | + $wgOut->addHTML( Xml::checkLabel( wfMsg( 'maintenance-option-globals' ), 'wpGlobals', 'wpGlobals' ) . '<br />' ); |
| 132 | + } |
131 | 133 | if( $this->metadata[$type]['batch'] ) { |
132 | | - $wgOut->addHTML( Xml::inputLabel( wfMsg( 'maintenance-option-batch-size', $this->metadata[$type]['batch'] ), 'wpBatch-size', 'wpBatch-size' ) . '<br /><br />' ); |
| 134 | + $wgOut->addHTML( Xml::inputLabel( wfMsg( 'maintenance-option-batch-size', $this->metadata[$type]['batch'] ), 'wpBatch-size', 'wpBatch-size' ) . '<br />' ); |
133 | 135 | } |
134 | 136 | $wgOut->addHTML( Xml::submitButton( wfMsg( 'maintenance-option-confirm' ), array( 'name' => 'wpConfirm' ) ) . '</form>' ); |
135 | 137 | return; |
136 | 138 | } |
137 | 139 | |
138 | 140 | private function executeScript( $type ) { |
139 | | - global $wgOut, $wgRequest, $wgUser, $IP, $wgMaintenanceScripts; |
| 141 | + global $wgOut, $wgRequest, $wgUser, $IP, $wgMaintenanceScripts, $wgMaintenanceDebug; |
140 | 142 | |
141 | 143 | $this->setHeaders(); |
142 | 144 | $wgOut->addHTML( $wgUser->getSkin()->makeKnownLinkObj( $this->getTitle(), wfMsgHtml( 'maintenance-backlink' ) ). '<br />' ); |
— | — | @@ -329,7 +331,9 @@ |
330 | 332 | if( $needhax ) { |
331 | 333 | unlink( $fname ); |
332 | 334 | } |
333 | | - $script->globals(); |
| 335 | + if( $wgMaintenanceDebug ) { |
| 336 | + $script->globals(); |
| 337 | + } |
334 | 338 | $wgOut->addHTML( wfMsgExt( 'maintenance-output-success', array( 'escape' ), $this->type ) . "\n" ); |
335 | 339 | } catch( SpecialMaintenanceException $e ) { |
336 | 340 | $wgOut->addHTML( wfMsgExt( 'maintenance-output-failure', array( 'escape' ), $this->type ) . "\n" ); |
— | — | @@ -358,7 +362,8 @@ |
359 | 363 | |
360 | 364 | //make sure that the script exists |
361 | 365 | if( !file_exists( "$IP/maintenance/$script.php" ) && !array_key_exists( $script, $wgMaintenanceScripts ) ) { |
362 | | - return false; |
| 366 | + unset( $this->scripts[$i] ); //remove it from the list of scripts |
| 367 | + continue; |
363 | 368 | } |
364 | 369 | |
365 | 370 | //parse options |
Index: trunk/extensions/Maintenance/Maintenance.i18n.php |
— | — | @@ -86,7 +86,7 @@ |
87 | 87 | 'maintenance-checkBadRedirects-output-found' => "Found \$1 redirects.\nChecking for bad redirects...", #$1=number of redirects |
88 | 88 | 'maintenance-checkBadRedirects-output-footer' => "\nDone.", |
89 | 89 | // checkImages |
90 | | - 'maintenance-checkImages' => 'Use this form to see which images on your server are corrupted', |
| 90 | + 'maintenance-checkImages' => 'Use this form to see which images on your wiki are corrupted', |
91 | 91 | 'maintenance-checkImages-desc' => 'Check images to see if they exist, are readable, etc', |
92 | 92 | 'maintenance-checkImages-output-noaccess' => '$1: not locally accessible', #$1=image name |
93 | 93 | 'maintenance-checkImages-output-missing' => '$1: missing', #$1=image name |
— | — | @@ -100,7 +100,7 @@ |
101 | 101 | 'maintenance-checkSyntax-option-with-extensions' => 'Also recurse the extensions folder', |
102 | 102 | 'maintenance-checkSyntax-option-path' => 'Specific path (file or directory) to check, either with absolute path or relative to the root of this MediaWiki installation', |
103 | 103 | 'maintenance-checkSyntax-option-list-file' => 'List of files or directories to check', |
104 | | - 'maintenance-checkSyntax-option-modified' => 'Check only files that were modified (requires SVN command-line client)', |
| 104 | + 'maintenance-checkSyntax-option-modified' => 'Check only files that were modified (requires svn command-line client)', |
105 | 105 | 'maintenance-checkSyntax-option-syntax-only' => 'Check for syntax validity only, skip code style warnings', |
106 | 106 | 'maintenance-checkSyntax-output-parsekit' => 'Checking syntax (using parsekit)', |
107 | 107 | 'maintenance-checkSyntax-output-phpl' => 'Checking syntax (using php -l, this can take a long time)', |
— | — | @@ -135,9 +135,24 @@ |
136 | 136 | 'maintenance-cleanupCaps-error-noneed' => '$wgCapitalLinks is on -- no need for caps links cleanup.', |
137 | 137 | // cleanupImages |
138 | 138 | // cleanupSpam |
| 139 | + 'maintenance-cleanupSpam' => 'Use this form to revert spam edits that link to external sites', |
| 140 | + 'maintenance-cleanupSpam-desc' => 'Clean up all spam from a given hostname', |
| 141 | + 'maintenance-cleanupSpam-arg-hostname' => 'Hostname that was spamming', |
| 142 | + 'maintenance-cleanupSpam-output-found' => 'Found $1 {{PLURAL:$1|articles|article}} containing $2', #$1=count, $2=hostname |
| 143 | + 'maintenance-cleanupSpam-output-done' => '{{int:maintenance-generic-done}}', |
| 144 | + 'maintenance-cleanupSpam-output-false' => 'False match', |
| 145 | + 'maintenance-cleanupSpam-output-blanking' => 'blanking', |
| 146 | + 'maintenance-cleanupSpam-output-reverting' => 'reverting', |
| 147 | + 'maintenance-cleanupSpam-output-page' => '$1 ...', #$1=page name |
| 148 | + 'maintenance-cleanupSpam-error-invalid' => 'Not a valid hostname specification: $1', #$1=hostname |
| 149 | + 'maintenance-cleanupSpam-error-noid' => 'Internal error: no page for ID $1', #$1=page id |
139 | 150 | // cleanupTitles |
140 | 151 | // cleanupWatchlist |
141 | 152 | // clear_interwiki_cache |
| 153 | + 'maintenance-clear_interwiki_cache' => 'Use this form to completely clear the interwiki cache', |
| 154 | + 'maintenance-clear_interwiki_cache-desc' => 'Clear all interwiki links for all languages from the cache', |
| 155 | + 'maintenance-clear_interwiki_cache-done' => '{{int:maintenance-generic-done}}', |
| 156 | + 'maintenance-clear_interwiki_cache-db' => '$1...', #$1=db name |
142 | 157 | // clear_stats |
143 | 158 | // convertLinks |
144 | 159 | // convertUserOptions |
— | — | @@ -145,6 +160,13 @@ |
146 | 161 | 'maintenance-createAndPromote' => 'Use this form to create a new user and promote it to administrator. Check the bureaucrat box if you wish to promote to bureaucrat as well', |
147 | 162 | 'maintenance-createAndPromote-desc' => 'Create a user and promote to administrator status', |
148 | 163 | 'maintenance-createAndPromote-option-bureaucrat' => 'Promote user to bureaucrat status', |
| 164 | + 'maintenance-createAndPromote-option-username' => '{{int:maintenance-generic-username}}', |
| 165 | + 'maintenance-createAndPromote-option-password' => '{{int:maintenance-generic-password}}', |
| 166 | + 'maintenance-createAndPromote-output-creating' => 'Creating and promoting User:$2...', #$1=wiki id, $2=username |
| 167 | + 'maintenance-createAndPromote-output-done' => '{{int:maintenance-generic-done}}', |
| 168 | + 'maintenance-createAndPromote-error-invalid' => '{{int:noname}}', |
| 169 | + 'maintenance-createAndPromote-error-exists' => '{{int:userexists}}', |
| 170 | + 'maintenance-createAndPromote-error-password' => 'An error was encountered with the password you entered: $1', #$1=password error |
149 | 171 | // deleteArchivedFiles |
150 | 172 | // deleteArchivedRevisions |
151 | 173 | // deleteBatch |