https://www.mediawiki.org/wiki/Special:Code/MediaWiki/114345
Revision: 114345
Author: skizzerz
Date: 2012-03-21 05:03:43 +0000 (Wed, 21 Mar 2012)
Log Message:
-----------
* Add $wgMaintenanceDebug global to configure the "Show debug information" box,
which potentially reveals information such as environment variables
* The metadata.ini parser no longer fails outright when it encounters a script
that does not exist on the server, it now just ignores that script (fixes
"metadata.ini corrupted or missing" error on 1.18 and others)
* Modify some wording in checkImages and checkSyntax scripts
* Now supports three more scripts: cleanupSpam, clear_interwiki_cache,
createAndPromote
* Bump version number to 2.1.0
Modified Paths:
--------------
trunk/extensions/Maintenance/Maintenance.i18n.php
trunk/extensions/Maintenance/Maintenance.php
trunk/extensions/Maintenance/Maintenance_body.php
trunk/extensions/Maintenance/metadata.ini
Modified: trunk/extensions/Maintenance/Maintenance.i18n.php
===================================================================
--- trunk/extensions/Maintenance/Maintenance.i18n.php 2012-03-21 03:36:52 UTC
(rev 114344)
+++ trunk/extensions/Maintenance/Maintenance.i18n.php 2012-03-21 05:03:43 UTC
(rev 114345)
@@ -86,7 +86,7 @@
'maintenance-checkBadRedirects-output-found' => "Found \$1
redirects.\nChecking for bad redirects...", #$1=number of redirects
'maintenance-checkBadRedirects-output-footer' => "\nDone.",
// checkImages
- 'maintenance-checkImages' => 'Use this form to see which images on your
server are corrupted',
+ 'maintenance-checkImages' => 'Use this form to see which images on your
wiki are corrupted',
'maintenance-checkImages-desc' => 'Check images to see if they exist,
are readable, etc',
'maintenance-checkImages-output-noaccess' => '$1: not locally
accessible', #$1=image name
'maintenance-checkImages-output-missing' => '$1: missing', #$1=image
name
@@ -100,7 +100,7 @@
'maintenance-checkSyntax-option-with-extensions' => 'Also recurse the
extensions folder',
'maintenance-checkSyntax-option-path' => 'Specific path (file or
directory) to check, either with absolute path or relative to the root of this
MediaWiki installation',
'maintenance-checkSyntax-option-list-file' => 'List of files or
directories to check',
- 'maintenance-checkSyntax-option-modified' => 'Check only files that
were modified (requires SVN command-line client)',
+ 'maintenance-checkSyntax-option-modified' => 'Check only files that
were modified (requires svn command-line client)',
'maintenance-checkSyntax-option-syntax-only' => 'Check for syntax
validity only, skip code style warnings',
'maintenance-checkSyntax-output-parsekit' => 'Checking syntax (using
parsekit)',
'maintenance-checkSyntax-output-phpl' => 'Checking syntax (using php
-l, this can take a long time)',
@@ -135,9 +135,24 @@
'maintenance-cleanupCaps-error-noneed' => '$wgCapitalLinks is on -- no
need for caps links cleanup.',
// cleanupImages
// cleanupSpam
+ 'maintenance-cleanupSpam' => 'Use this form to revert spam edits that
link to external sites',
+ 'maintenance-cleanupSpam-desc' => 'Clean up all spam from a given
hostname',
+ 'maintenance-cleanupSpam-arg-hostname' => 'Hostname that was spamming',
+ 'maintenance-cleanupSpam-output-found' => 'Found $1
{{PLURAL:$1|articles|article}} containing $2', #$1=count, $2=hostname
+ 'maintenance-cleanupSpam-output-done' =>
'{{int:maintenance-generic-done}}',
+ 'maintenance-cleanupSpam-output-false' => 'False match',
+ 'maintenance-cleanupSpam-output-blanking' => 'blanking',
+ 'maintenance-cleanupSpam-output-reverting' => 'reverting',
+ 'maintenance-cleanupSpam-output-page' => '$1 ...', #$1=page name
+ 'maintenance-cleanupSpam-error-invalid' => 'Not a valid hostname
specification: $1', #$1=hostname
+ 'maintenance-cleanupSpam-error-noid' => 'Internal error: no page for ID
$1', #$1=page id
// cleanupTitles
// cleanupWatchlist
// clear_interwiki_cache
+ 'maintenance-clear_interwiki_cache' => 'Use this form to completely
clear the interwiki cache',
+ 'maintenance-clear_interwiki_cache-desc' => 'Clear all interwiki links
for all languages from the cache',
+ 'maintenance-clear_interwiki_cache-done' =>
'{{int:maintenance-generic-done}}',
+ 'maintenance-clear_interwiki_cache-db' => '$1...', #$1=db name
// clear_stats
// convertLinks
// convertUserOptions
@@ -145,6 +160,13 @@
'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',
'maintenance-createAndPromote-desc' => 'Create a user and promote to
administrator status',
'maintenance-createAndPromote-option-bureaucrat' => 'Promote user to
bureaucrat status',
+ 'maintenance-createAndPromote-option-username' =>
'{{int:maintenance-generic-username}}',
+ 'maintenance-createAndPromote-option-password' =>
'{{int:maintenance-generic-password}}',
+ 'maintenance-createAndPromote-output-creating' => 'Creating and
promoting User:$2...', #$1=wiki id, $2=username
+ 'maintenance-createAndPromote-output-done' =>
'{{int:maintenance-generic-done}}',
+ 'maintenance-createAndPromote-error-invalid' => '{{int:noname}}',
+ 'maintenance-createAndPromote-error-exists' => '{{int:userexists}}',
+ 'maintenance-createAndPromote-error-password' => 'An error was
encountered with the password you entered: $1', #$1=password error
// deleteArchivedFiles
// deleteArchivedRevisions
// deleteBatch
Modified: trunk/extensions/Maintenance/Maintenance.php
===================================================================
--- trunk/extensions/Maintenance/Maintenance.php 2012-03-21 03:36:52 UTC
(rev 114344)
+++ trunk/extensions/Maintenance/Maintenance.php 2012-03-21 05:03:43 UTC
(rev 114345)
@@ -4,29 +4,41 @@
*
* @file
* @ingroup Extensions
- * @version 2.0.0
+ * @version 2.1.0
* @author Ryan Schmidt
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
2.0 or later
* @link http://www.mediawiki.org/wiki/Extension:Maintenance Documentation
*/
if( !defined('MEDIAWIKI') ) {
- echo("This file is an extension to the MediaWiki software and is not a
valid access point");
- die(1);
+ echo "This file is an extension to the MediaWiki software and is not a
valid access point";
+ die( 1 );
}
+// !!!!!!!!!
+// BEGIN EXTENSION CONFIGURATION SECTION
+// !!!!!!!!!
+
+// Whether or not to show the "Output globals at the end of processing for
debugging" checkbox
+// NOTE: enabling this can reveal system information such as environment
variables
+$wgMaintenanceDebug = false;
+
+// !!!!!!!!!
+// END EXTENSION CONFIGURATION SECTION
+// !!!!!!!!!
+
// Extension credits that will show up on Special:Version
$wgExtensionCredits['specialpage'][] = array(
'path' => __FILE__,
'name' => 'Maintenance',
'author' => 'Ryan Schmidt',
- 'version' => '2.0.0',
+ 'version' => '2.1.0',
'descriptionmsg' => 'maintenance-desc',
'url' => 'https://www.mediawiki.org/wiki/Extension:Maintenance',
);
// Set up the new special page
-$dir = dirname(__FILE__) . '/';
+$dir = dirname( __FILE__ ) . '/';
$wgExtensionMessagesFiles['Maintenance'] = $dir . 'Maintenance.i18n.php';
$wgExtensionMessagesFiles['MaintenanceAlias'] = $dir . 'Maintenance.alias.php';
$wgAutoloadClasses['SpecialMaintenance'] = $dir . 'Maintenance_body.php';
Modified: trunk/extensions/Maintenance/Maintenance_body.php
===================================================================
--- trunk/extensions/Maintenance/Maintenance_body.php 2012-03-21 03:36:52 UTC
(rev 114344)
+++ trunk/extensions/Maintenance/Maintenance_body.php 2012-03-21 05:03:43 UTC
(rev 114345)
@@ -94,7 +94,7 @@
}
private function makeForm( $type ) {
- global $wgOut, $wgUser;
+ global $wgOut, $wgUser, $wgMaintenanceDebug;
$this->setHeaders();
$wgOut->addHTML( $wgUser->getSkin()->makeKnownLinkObj(
$this->getTitle(), wfMsgHtml( 'maintenance-backlink' ) ). '<br />' );
@@ -112,30 +112,32 @@
foreach( $options as $option ) {
switch( $option['type'] ) {
case 'check':
- $wgOut->addHTML( Xml::checkLabel(
wfMsg( "maintenance-$type-option-" . $option['name'] ), 'wp' . ucfirst(
$option['name'] ), 'wp' . ucfirst( $option['name'] ), $option['default'] ) .
'<br /><br />' );
+ $wgOut->addHTML( Xml::checkLabel(
wfMsg( "maintenance-$type-option-" . $option['name'] ), 'wp' . ucfirst(
$option['name'] ), 'wp' . ucfirst( $option['name'] ), $option['default'] ) .
'<br />' );
break;
case 'input':
- $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 />' );
+ $wgOut->addHTML( Xml::inputLabel(
wfMsg( "maintenance-$type-option-" . $option['name'] ), 'wp' . ucfirst(
$option['name'] ), 'wp' . ucfirst( $option['name'] ), $option['size'], false,
$option['attrib'] ) . '<br />' );
break;
case 'password':
- $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 />' );
+ $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 />' );
break;
case 'textarea':
- $wgOut->addHTML( wfMsg(
"maintenance-$type-option-" . $option['name'] ) . '<textarea name="wp' .
ucfirst( $option['name'] ) . '" rows="25" cols="80"></textarea><br /><br />');
+ $wgOut->addHTML( wfMsg(
"maintenance-$type-option-" . $option['name'] ) . '<textarea name="wp' .
ucfirst( $option['name'] ) . '" rows="25" cols="80"></textarea><br />');
break;
}
}
- $wgOut->addHTML( Xml::checkLabel( wfMsg(
'maintenance-option-quiet' ), 'wpQuiet', 'wpQuiet' ) . '<br /><br />' );
- $wgOut->addHTML( Xml::checkLabel( wfMsg(
'maintenance-option-globals' ), 'wpGlobals', 'wpGlobals' ) . '<br /><br />' );
+ $wgOut->addHTML( Xml::checkLabel( wfMsg(
'maintenance-option-quiet' ), 'wpQuiet', 'wpQuiet' ) . '<br />' );
+ if( $wgMaintenanceDebug ) {
+ $wgOut->addHTML( Xml::checkLabel( wfMsg(
'maintenance-option-globals' ), 'wpGlobals', 'wpGlobals' ) . '<br />' );
+ }
if( $this->metadata[$type]['batch'] ) {
- $wgOut->addHTML( Xml::inputLabel( wfMsg(
'maintenance-option-batch-size', $this->metadata[$type]['batch'] ),
'wpBatch-size', 'wpBatch-size' ) . '<br /><br />' );
+ $wgOut->addHTML( Xml::inputLabel( wfMsg(
'maintenance-option-batch-size', $this->metadata[$type]['batch'] ),
'wpBatch-size', 'wpBatch-size' ) . '<br />' );
}
$wgOut->addHTML( Xml::submitButton( wfMsg(
'maintenance-option-confirm' ), array( 'name' => 'wpConfirm' ) ) . '</form>' );
return;
}
private function executeScript( $type ) {
- global $wgOut, $wgRequest, $wgUser, $IP, $wgMaintenanceScripts;
+ global $wgOut, $wgRequest, $wgUser, $IP, $wgMaintenanceScripts,
$wgMaintenanceDebug;
$this->setHeaders();
$wgOut->addHTML( $wgUser->getSkin()->makeKnownLinkObj(
$this->getTitle(), wfMsgHtml( 'maintenance-backlink' ) ). '<br />' );
@@ -329,7 +331,9 @@
if( $needhax ) {
unlink( $fname );
}
- $script->globals();
+ if( $wgMaintenanceDebug ) {
+ $script->globals();
+ }
$wgOut->addHTML( wfMsgExt(
'maintenance-output-success', array( 'escape' ), $this->type ) . "\n" );
} catch( SpecialMaintenanceException $e ) {
$wgOut->addHTML( wfMsgExt(
'maintenance-output-failure', array( 'escape' ), $this->type ) . "\n" );
@@ -358,7 +362,8 @@
//make sure that the script exists
if( !file_exists( "$IP/maintenance/$script.php" ) &&
!array_key_exists( $script, $wgMaintenanceScripts ) ) {
- return false;
+ unset( $this->scripts[$i] ); //remove it from
the list of scripts
+ continue;
}
//parse options
Modified: trunk/extensions/Maintenance/metadata.ini
===================================================================
--- trunk/extensions/Maintenance/metadata.ini 2012-03-21 03:36:52 UTC (rev
114344)
+++ trunk/extensions/Maintenance/metadata.ini 2012-03-21 05:03:43 UTC (rev
114345)
@@ -82,7 +82,15 @@
enabled = 0
[cleanupSpam]
-enabled = 0
+arg = "hostname input"
+output[] = "found regex Found (.*) articles containing (.*)"
+output[] = "done string Done"
+output[] = "false string False match"
+output[] = "blanking string blanking"
+output[] = "reverting string reverting"
+output[] = "page regex (.*) \.\.\."
+error[] = "invalid regex Not a valid hostname specification: (.*)"
+error[] = "noid regex Internal error: no page for ID (.*)"
[cleanupTitles]
enabled = 0
@@ -91,7 +99,8 @@
enabled = 0
[clear_interwiki_cache]
-enabled = 0
+output[] = "db regex (.*)\.\.\."
+output[] = "done string done"
[clear_stats]
enabled = 0
@@ -103,7 +112,14 @@
enabled = 0
[createAndPromote]
-enabled = 0
+arg[] = "username input"
+arg[] = "password password"
+option = "bureaucrat check"
+output[] = "creating regex (.*): Creating and promoting User:(.*)\.\.\."
+output[] = "done string done."
+error[] = "invalid string invalid username."
+error[] = "exists string account exists."
+error[] = "password regex (.*)"
[deleteArchivedFiles]
enabled = 0
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs