summaryrefslogtreecommitdiff
path: root/maintenance/deleteDefaultMessages.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2011-06-22 11:28:20 +0200
committerPierre Schmitz <pierre@archlinux.de>2011-06-22 11:28:20 +0200
commit9db190c7e736ec8d063187d4241b59feaf7dc2d1 (patch)
tree46d1a0dee7febef5c2d57a9f7b972be16a163b3d /maintenance/deleteDefaultMessages.php
parent78677c7bbdcc9739f6c10c75935898a20e1acd9e (diff)
update to MediaWiki 1.17.0
Diffstat (limited to 'maintenance/deleteDefaultMessages.php')
-rw-r--r--maintenance/deleteDefaultMessages.php32
1 files changed, 21 insertions, 11 deletions
diff --git a/maintenance/deleteDefaultMessages.php b/maintenance/deleteDefaultMessages.php
index 3f0e1b1c..fc482ac0 100644
--- a/maintenance/deleteDefaultMessages.php
+++ b/maintenance/deleteDefaultMessages.php
@@ -1,6 +1,6 @@
<?php
/**
- * Deletes all pages in the MediaWiki namespace which were last edited by
+ * Deletes all pages in the MediaWiki namespace which were last edited by
* "MediaWiki default".
*
* This program is free software; you can redistribute it and/or modify
@@ -21,7 +21,7 @@
* @ingroup Maintenance
*/
-require_once( dirname(__FILE__) . '/Maintenance.php' );
+require_once( dirname( __FILE__ ) . '/Maintenance.php' );
class DeleteDefaultMessages extends Maintenance {
public function __construct() {
@@ -31,17 +31,11 @@ class DeleteDefaultMessages extends Maintenance {
}
public function execute() {
- self::reallyExecute();
- }
-
- public static function reallyExecute() {
+
$user = 'MediaWiki default';
$reason = 'No longer required';
- global $wgUser;
- $wgUser = User::newFromName( $user );
- $wgUser->addGroup( 'bot' );
-
+ $this->output( "Checking existence of old default messages..." );
$dbr = wfGetDB( DB_SLAVE );
$res = $dbr->select( array( 'page', 'revision' ),
array( 'page_namespace', 'page_title' ),
@@ -52,6 +46,20 @@ class DeleteDefaultMessages extends Maintenance {
)
);
+ if( $dbr->numRows( $res ) == 0 ) {
+ # No more messages left
+ $this->output( "done.\n" );
+ return;
+ }
+
+ # Deletions will be made by $user temporarly added to the bot group
+ # in order to hide it in RecentChanges.
+ global $wgUser;
+ $wgUser = User::newFromName( $user );
+ $wgUser->addGroup( 'bot' );
+
+ # Handle deletion
+ $this->output( "\n...deleting old default messages (this may take a long time!)...", 'msg' );
$dbw = wfGetDB( DB_MASTER );
foreach ( $res as $row ) {
@@ -65,8 +73,10 @@ class DeleteDefaultMessages extends Maintenance {
$article->doDeleteArticle( $reason );
$dbw->commit();
}
+
+ $this->output( 'done!', 'msg' );
}
}
$maintClass = "DeleteDefaultMessages";
-require_once( DO_MAINTENANCE );
+require_once( RUN_MAINTENANCE_IF_MAIN );