* Add functionality of extension Nuke to core. Messages for other languages will...
authorSiebrand Mazeland <siebrand@users.mediawiki.org>
Sat, 4 Oct 2008 00:33:07 +0000 (00:33 +0000)
committerSiebrand Mazeland <siebrand@users.mediawiki.org>
Sat, 4 Oct 2008 00:33:07 +0000 (00:33 +0000)
* Update Translate

14 files changed:
RELEASE-NOTES
includes/AutoLoader.php
includes/DefaultSettings.php
includes/SpecialPage.php
includes/specials/SpecialNuke.php [new file with mode: 0644]
languages/messages/MessagesAr.php
languages/messages/MessagesArz.php
languages/messages/MessagesDe.php
languages/messages/MessagesEn.php
languages/messages/MessagesHe.php
languages/messages/MessagesNds_nl.php
languages/messages/MessagesNl.php
languages/messages/MessagesNo.php
maintenance/language/messages.inc

index d78a192..7c21a26 100644 (file)
@@ -58,6 +58,7 @@ The following extensions are migrated into MediaWiki 1.14:
 * Special:LinkSearch to search for external links (was extension LinkSearch)
 * RenderHash
 * NoMoveUserPages
+* Special:Nuke to mass delete all pages created by a user
 
 === New features in 1.14 ===
 
index f9897e2..4ad086f 100644 (file)
@@ -477,6 +477,7 @@ $wgAutoloadLocalClasses = array(
        'SpecialBookSources' => 'includes/specials/SpecialBooksources.php',
        'SpecialListGroupRights' => 'includes/specials/SpecialListgrouprights.php',
        'SpecialMostlinkedtemplates' => 'includes/specials/SpecialMostlinkedtemplates.php',
+       'SpecialNuke' => 'includes/specials/SpecialNuke.php',
        'SpecialPrefixindex' => 'includes/specials/SpecialPrefixindex.php',
        'SpecialRandomredirect' => 'includes/specials/SpecialRandomredirect.php',
        'SpecialRecentchanges' => 'includes/specials/SpecialRecentchanges.php',
index 78b7327..ea478c7 100644 (file)
@@ -1183,6 +1183,8 @@ $wgGroupPermissions['sysop']['suppressredirect'] = true;
 $wgGroupPermissions['sysop']['apihighlimits']    = true;
 $wgGroupPermissions['sysop']['browsearchive']    = true;
 $wgGroupPermissions['sysop']['noratelimit']      = true;
+$wgGroupPermissions['sysop']['nuke']             = true;
+
 #$wgGroupPermissions['sysop']['mergehistory']     = true;
 
 // Permission to change users' group assignments
@@ -2850,6 +2852,7 @@ $wgSpecialPageGroups = array(
        'Export'                    => 'pagetools',
        'Import'                    => 'pagetools',
        'Whatlinkshere'             => 'pagetools',
+       'Nuke'                      => 'pagetools',
 
        'Statistics'                => 'wiki',
        'Version'                   => 'wiki',
index fec6c0a..cf16546 100644 (file)
@@ -164,6 +164,7 @@ class SpecialPage
                'Listadmins'                => array( 'SpecialRedirectToSpecial', 'Listadmins', 'Listusers', 'sysop' ),
                'MergeHistory'              => array( 'SpecialPage', 'MergeHistory', 'mergehistory' ),
                'Listbots'                  => array( 'SpecialRedirectToSpecial', 'Listbots', 'Listusers', 'bot' ),
+               'Nuke'                      => 'SpecialNuke',
        );
 
        static public $mAliases;
diff --git a/includes/specials/SpecialNuke.php b/includes/specials/SpecialNuke.php
new file mode 100644 (file)
index 0000000..0b68071
--- /dev/null
@@ -0,0 +1,159 @@
+<?php
+/**
+ * @file
+ * @ingroup SpecialPage
+ *
+ * @author Brion Vibber
+ * @copyright Copyright © 2005-2008, Brion Vibber
+ * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
+ */
+
+/**
+ * implements Special:Nuke
+ */
+
+class SpecialNuke extends SpecialPage {
+       function __construct() {
+               parent::__construct( 'Nuke', 'nuke' );
+       }
+
+       function execute( $par ){
+               global $wgUser, $wgRequest;
+
+               if( !$this->userCanExecute( $wgUser ) ){
+                       $this->displayRestrictionError();
+                       return;
+               }
+
+               $this->setHeaders();
+               $this->outputHeader();
+
+               $target = $wgRequest->getText( 'target', $par );
+               $reason = $wgRequest->getText( 'wpReason',
+                       wfMsgForContent( 'nuke-defaultreason', $target ) );
+               $posted = $wgRequest->wasPosted() &&
+                       $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) );
+               if( $posted ) {
+                       $pages = $wgRequest->getArray( 'pages' );
+                       if( $pages ) {
+                               return $this->doDelete( $pages, $reason );
+                       }
+               }
+               if( $target != '' ) {
+                       $this->listForm( $target, $reason );
+               } else {
+                       $this->promptForm();
+               }
+       }
+
+       function promptForm() {
+               global $wgUser, $wgOut;
+               $sk =& $wgUser->getSkin();
+
+               $nuke = Title::makeTitle( NS_SPECIAL, 'Nuke' );
+               $submit = Xml::element( 'input', array( 'type' => 'submit', 'value' => wfMsgHtml( 'nuke-submit-user' ) ) );
+
+               $wgOut->addWikiText( wfMsg( 'nuke-tools' ) );
+               $wgOut->addHTML( Xml::element( 'form', array(
+                               'action' => $nuke->getLocalURL( 'action=submit' ),
+                               'method' => 'post' ),
+                               null ) .
+                       Xml::element( 'input', array(
+                               'type' => 'text',
+                               'size' => 40,
+                               'name' => 'target' ) ) .
+                       "\n$submit\n" );
+
+               $wgOut->addHTML( "</form>" );
+       }
+
+       function listForm( $username, $reason ) {
+               global $wgUser, $wgOut, $wgLang;
+
+               $pages = $this->getNewPages( $username );
+               $escapedName = wfEscapeWikiText( $username );
+               if( count( $pages ) == 0 ) {
+                       $wgOut->addWikiText( wfMsg( 'nuke-nopages', $escapedName ) );
+                       return $this->promptForm();
+               }
+               $wgOut->addWikiText( wfMsg( 'nuke-list', $escapedName ) );
+
+               $nuke = $this->getTitle();
+               $submit = Xml::element( 'input', array( 'type' => 'submit', 'value' => wfMsgHtml( 'nuke-submit-delete' ) ) );
+
+               $wgOut->addHTML( Xml::element( 'form', array(
+                       'action' => $nuke->getLocalURL( 'action=delete' ),
+                       'method' => 'post' ),
+                       null ) .
+                       "\n<div>" .
+                       wfMsgHtml( 'deletecomment' ) . ' ' .
+                       Xml::element( 'input', array(
+                               'name' => 'wpReason',
+                               'value' => $reason,
+                               'size' => 60 ) ) .
+                       "</div><br />" .
+                       $submit .
+                       Xml::element( 'input', array(
+                               'type' => 'hidden',
+                               'name' => 'wpEditToken',
+                               'value' => $wgUser->editToken() ) ) .
+                       "\n<ul>\n" );
+
+               $sk =& $wgUser->getSkin();
+               foreach( $pages as $info ) {
+                       list( $title, $edits ) = $info;
+                       $image = $title->getNamespace() == NS_IMAGE ? wfLocalFile( $title ) : false;
+                       $thumb = $image && $image->exists() ? $image->getThumbnail( 120, 120 ) : false;
+
+                       $wgOut->addHTML( '<li>' .
+                               Xml::element( 'input', array(
+                                       'type' => 'checkbox',
+                                       'name' => "pages[]",
+                                       'value' => $title->getPrefixedDbKey(),
+                                       'checked' => 'checked' ) ) .
+                               '&nbsp;' .
+                               ( $thumb ? $thumb->toHtml( array( 'desc-link' => true ) ) : '' ) .
+                               $sk->makeKnownLinkObj( $title ) .
+                               '&nbsp;(' .
+                               $sk->makeKnownLinkObj( $title, wfMsgExt( 'nchanges', array( 'parsemag' ), $wgLang->formatNum( $edits ) ), 'action=history' ) .
+                               ")</li>\n" );
+               }
+               $wgOut->addHTML( "</ul>\n$submit</form>" );
+       }
+
+       function getNewPages( $username ) {
+               $dbr = wfGetDB( DB_SLAVE );
+               $result = $dbr->select( 'recentchanges',
+                       array( 'rc_namespace', 'rc_title', 'rc_timestamp', 'COUNT(*) AS edits' ),
+                       array(
+                               'rc_user_text' => $username,
+                               '(rc_new = 1) OR (rc_log_type = "upload" AND rc_log_action = "upload")'
+                       ),
+                       __METHOD__,
+                       array(
+                               'ORDER BY' => 'rc_timestamp DESC',
+                               'GROUP BY' => 'rc_namespace, rc_title'
+                       )
+               );
+               $pages = array();
+               while( $row = $dbr->fetchObject( $result ) ) {
+                       $pages[] = array( Title::makeTitle( $row->rc_namespace, $row->rc_title ), $row->edits );
+               }
+               $dbr->freeResult( $result );
+               return $pages;
+       }
+
+       function doDelete( $pages, $reason ) {
+               foreach( $pages as $page ) {
+                       $title = Title::newFromUrl( $page );
+                       $file = $title->getNamespace() == NS_IMAGE ? wfLocalFile( $title ) : false;
+                       if ( $file ) {
+                               $oldimage = null; // Must be passed by reference
+                               FileDeleteForm::doDelete( $title, $file, $oldimage, $reason, false );
+                       } else {
+                               $article = new Article( $title );
+                               $article->doDelete( $reason );
+                       }
+               }
+       }
+}
index 950e312..ba530ff 100644 (file)
@@ -367,6 +367,7 @@ $specialPageAliases = array(
        'Blankpage'                 => array( 'صفحة_فارغة' ),
        'LinkSearch'                => array( 'بحث_الوصلات' ),
        'DeletedContributions'      => array( 'مساهمات_محذوفة' ),
+       'Nuke'                      => array( 'حذف_كمي' ),
 );
 
 $imageFiles = array(
index 7a6066c..d2cf231 100644 (file)
@@ -264,6 +264,7 @@ $specialPageAliases = array(
        'Blankpage'                 => array( 'صفحة_فارغة' ),
        'LinkSearch'                => array( 'بحث_الوصلات' ),
        'DeletedContributions'      => array( 'مساهمات_محذوفة' ),
+       'Nuke'                      => array( 'حذف_كمى' ),
 );
 
 $messages = array(
index c292086..7e1b685 100644 (file)
@@ -157,6 +157,7 @@ $specialPageAliases = array(
        'Blankpage'                 => array( 'Leerseite' ),
        'LinkSearch'                => array( 'Weblink-Suche' ),
        'DeletedContributions'      => array( 'Gelöschte Beiträge' ),
+       'Nuke'                      => array( 'Massenlöschung' ),
 );
 
 $datePreferences = array(
index f13312d..df95fd2 100644 (file)
@@ -439,6 +439,7 @@ $specialPageAliases = array(
        'Blankpage'                 => array( 'BlankPage' ),
        'LinkSearch'                => array( 'LinkSearch' ),
        'DeletedContributions'      => array( 'DeletedContributions' ),
+       'Nuke'                      => array( 'Nuke' ),
 );
 
 /**
@@ -3670,4 +3671,16 @@ Enter the filename without the "{{ns:image}}:" prefix.',
 
 #Put all regex fragments above this line. Leave this line exactly as it is</pre>',
 
+# Special:Nuke
+'nuke'               => 'Mass delete',
+'nuke-nopages'       => 'No new pages by [[Special:Contributions/$1|$1]] in recent changes.',
+'nuke-list'          => 'The following pages were recently created by [[Special:Contributions/$1|$1]];
+put in a comment and hit the button to delete them.',
+'nuke-defaultreason' => 'Mass removal of pages added by $1',
+'nuke-tools'         => 'This tool allows for mass deletions of pages recently added by a given user or IP.
+Input the username or IP to get a list of pages to delete.',
+'nuke-submit-user'   => 'Go',
+'nuke-submit-delete' => 'Delete selected',
+'right-nuke'         => 'Mass delete pages',
+
 );
index 7fb5394..68400ab 100644 (file)
@@ -283,6 +283,7 @@ $specialPageAliases = array(
        'Blankpage'                 => array( 'דף_ריק' ),
        'LinkSearch'                => array( 'חיפוש_קישורים_חיצוניים' ),
        'DeletedContributions'      => array( 'תרומות_מחוקות' ),
+       'Nuke'                      => array( 'מחיקה_מרובה' ),
 );
 
 $namespaceNames = array(
index 115afec..6ca928f 100644 (file)
@@ -251,6 +251,7 @@ $specialPageAliases = array(
        'Withoutinterwiki'          => array( 'Gien_interwiki' ),
        'LinkSearch'                => array( 'Verwiezingen_zeuken' ),
        'DeletedContributions'      => array( 'Vort-ehaolen gebrukersbiedragen' ),
+       'Nuke'                      => array( 'Massaal_vortdoon' ),
 );
 
 $linkTrail = '/^([a-zäöüïëéèà]+)(.*)$/sDu';
index a3f8cab..fae9188 100644 (file)
@@ -278,6 +278,7 @@ $specialPageAliases = array(
        'ListUserRestrictions'      => array( 'Gebruikersbeperkingen' ),
        'RemoveRestrictions'        => array( 'BeperkingenVerwijderen' ),
        'RestrictUser'              => array( 'GebruikerBeperken' ),
+       'Nuke'                      => array( 'MassaalVerwijderen' ),
 );
 
 $linkTrail = '/^([a-zäöüïëéèà]+)(.*)$/sDu';
index 90afc52..6d764ed 100644 (file)
@@ -163,6 +163,7 @@ $specialPageAliases = array(
        'Blankpage'                 => array( 'Blank side' ),
        'LinkSearch'                => array( 'Lenkesøk' ),
        'DeletedContributions'      => array( 'Slettede bidrag' ),
+       'Nuke'                      => array( 'Massesletting' ),
 );
 
 $messages = array(
index ecf3295..86c354f 100644 (file)
@@ -2759,6 +2759,17 @@ $wgMessageStructure = array(
        'external_images' => array(
                'external_image_whitelist',
        ),
+       'special-nuke' => array(
+               'nuke',
+               'nuke-nopages',
+               'nuke-list',
+               'nuke-defaultreason',
+               'nuke-tools',
+               'nuke-submit-user',
+               'nuke-submit-delete',
+               'right-nuke',
+       ),
+
 );
 
 /** Comments for each block */
@@ -2953,6 +2964,7 @@ Variants for Chinese language",
        'special-specialpages'  => 'Special:SpecialPages',
        'special-blank'         => 'Special:BlankPage',
        'external_images'       => 'External image whitelist',
+       'special-nuke'          => 'Special:Nuke',
 );
 
 /** Short comments for standalone messages */