From 9db190c7e736ec8d063187d4241b59feaf7dc2d1 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Wed, 22 Jun 2011 11:28:20 +0200 Subject: update to MediaWiki 1.17.0 --- maintenance/deleteDefaultMessages.php | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) (limited to 'maintenance/deleteDefaultMessages.php') 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 @@ 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 ); -- cgit v1.2.3-54-g00ecf