r73922 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r73921‎ | r73922 | r73923 >
Date:18:44, 28 September 2010
Author:hashar
Status:ok
Tags:
Comment:
Rewrite messenging for old message deletion. The old one is boring.
Modified paths:
  • /trunk/phase3/maintenance/deleteDefaultMessages.php (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/deleteDefaultMessages.php
@@ -32,15 +32,10 @@
3333
3434 public function execute() {
3535
36 - $this->output( 'Deleting old default messages (this may take a long time!)...', 'msg' );
37 -
3836 $user = 'MediaWiki default';
3937 $reason = 'No longer required';
40 -
41 - global $wgUser;
42 - $wgUser = User::newFromName( $user );
43 - $wgUser->addGroup( 'bot' );
44 -
 38+
 39+ $this->output( "Checking existence of old default messages..." );
4540 $dbr = wfGetDB( DB_SLAVE );
4641 $res = $dbr->select( array( 'page', 'revision' ),
4742 array( 'page_namespace', 'page_title' ),
@@ -51,6 +46,20 @@
5247 )
5348 );
5449
 50+ if( $dbr->numRows( $res ) == 0 ) {
 51+ # No more messages left
 52+ $this->output( "done.\n" );
 53+ return;
 54+ }
 55+
 56+ # Deletions will be made by $user temporarly added to the bot group
 57+ # in order to hide it in RecentChanges.
 58+ global $wgUser;
 59+ $wgUser = User::newFromName( $user );
 60+ $wgUser->addGroup( 'bot' );
 61+
 62+ # Handle deletion
 63+ $this->output( "\n...deleting old default messages (this may take a long time!)...", 'msg' );
5564 $dbw = wfGetDB( DB_MASTER );
5665
5766 foreach ( $res as $row ) {

Status & tagging log