r42117 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r42116‎ | r42117 | r42118 >
Date:21:35, 15 October 2008
Author:brion
Status:old
Tags:
Comment:
Back out r41630 -- merging of Nuke extension to core
Nuke started as a crappy hack, and it's still pretty crappy. ;) Needs better reversibility tools etc before we consider merging to core.
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/includes/AutoLoader.php (modified) (history)
  • /trunk/phase3/includes/DefaultSettings.php (modified) (history)
  • /trunk/phase3/includes/SpecialPage.php (modified) (history)
  • /trunk/phase3/includes/specials/SpecialNuke.php (deleted) (history)
  • /trunk/phase3/languages/messages/MessagesAr.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesArz.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesDe.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesEn.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesHe.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesNds_nl.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesNl.php (modified) (history)
  • /trunk/phase3/languages/messages/MessagesNo.php (modified) (history)
  • /trunk/phase3/maintenance/language/messages.inc (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/specials/SpecialNuke.php
@@ -1,160 +0,0 @@
2 -<?php
3 -/**
4 - * @file
5 - * @ingroup SpecialPage
6 - *
7 - * @author Brion Vibber
8 - * @copyright Copyright © 2005-2008, Brion Vibber
9 - * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
10 - */
11 -
12 -/**
13 - * implements Special:Nuke
14 - */
15 -
16 -class SpecialNuke extends SpecialPage {
17 - function __construct() {
18 - parent::__construct( 'Nuke', 'nuke' );
19 - }
20 -
21 - function execute( $par ){
22 - global $wgUser, $wgRequest;
23 -
24 - if( !$this->userCanExecute( $wgUser ) ){
25 - $this->displayRestrictionError();
26 - return;
27 - }
28 -
29 - $this->setHeaders();
30 - $this->outputHeader();
31 -
32 - $target = $wgRequest->getText( 'target', $par );
33 - $reason = $wgRequest->getText( 'wpReason',
34 - wfMsgForContent( 'nuke-defaultreason', $target ) );
35 - $posted = $wgRequest->wasPosted() &&
36 - $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) );
37 - if( $posted ) {
38 - $pages = $wgRequest->getArray( 'pages' );
39 - if( $pages ) {
40 - return $this->doDelete( $pages, $reason );
41 - }
42 - }
43 - if( $target != '' ) {
44 - $this->listForm( $target, $reason );
45 - } else {
46 - $this->promptForm();
47 - }
48 - }
49 -
50 - function promptForm() {
51 - global $wgUser, $wgOut;
52 -
53 - $sk = $wgUser->getSkin();
54 -
55 - $nuke = $this->getTitle();
56 - $submit = Xml::element( 'input', array( 'type' => 'submit', 'value' => wfMsgHtml( 'nuke-submit-user' ) ) );
57 -
58 - $wgOut->addWikiMsg( 'nuke-tools' );
59 - $wgOut->addHTML( Xml::element( 'form', array(
60 - 'action' => $nuke->getLocalURL( 'action=submit' ),
61 - 'method' => 'post' ),
62 - null ) .
63 - Xml::element( 'input', array(
64 - 'type' => 'text',
65 - 'size' => 40,
66 - 'name' => 'target' ) ) .
67 - "\n$submit\n" );
68 -
69 - $wgOut->addHTML( "</form>" );
70 - }
71 -
72 - function listForm( $username, $reason ) {
73 - global $wgUser, $wgOut, $wgLang;
74 -
75 - $pages = $this->getNewPages( $username );
76 - $escapedName = wfEscapeWikiText( $username );
77 - if( count( $pages ) == 0 ) {
78 - $wgOut->addWikiMsg( 'nuke-nopages', $escapedName );
79 - return $this->promptForm();
80 - }
81 - $wgOut->addWikiMsg( 'nuke-list', $escapedName );
82 -
83 - $nuke = $this->getTitle();
84 - $submit = Xml::element( 'input', array( 'type' => 'submit', 'value' => wfMsgHtml( 'nuke-submit-delete' ) ) );
85 -
86 - $wgOut->addHTML( Xml::element( 'form', array(
87 - 'action' => $nuke->getLocalURL( 'action=delete' ),
88 - 'method' => 'post' ),
89 - null ) .
90 - "\n<div>" .
91 - wfMsgHtml( 'deletecomment' ) . ' ' .
92 - Xml::element( 'input', array(
93 - 'name' => 'wpReason',
94 - 'value' => $reason,
95 - 'size' => 60 ) ) .
96 - "</div><br />" .
97 - $submit .
98 - Xml::element( 'input', array(
99 - 'type' => 'hidden',
100 - 'name' => 'wpEditToken',
101 - 'value' => $wgUser->editToken() ) ) .
102 - "\n<ul>\n" );
103 -
104 - $sk = $wgUser->getSkin();
105 - foreach( $pages as $info ) {
106 - list( $title, $edits ) = $info;
107 - $image = $title->getNamespace() == NS_IMAGE ? wfLocalFile( $title ) : false;
108 - $thumb = $image && $image->exists() ? $image->getThumbnail( 120, 120 ) : false;
109 -
110 - $wgOut->addHTML( '<li>' .
111 - Xml::element( 'input', array(
112 - 'type' => 'checkbox',
113 - 'name' => "pages[]",
114 - 'value' => $title->getPrefixedDbKey(),
115 - 'checked' => 'checked' ) ) .
116 - '&nbsp;' .
117 - ( $thumb ? $thumb->toHtml( array( 'desc-link' => true ) ) : '' ) .
118 - $sk->makeKnownLinkObj( $title ) .
119 - '&nbsp;(' .
120 - $sk->makeKnownLinkObj( $title, wfMsgExt( 'nchanges', array( 'parsemag' ), $wgLang->formatNum( $edits ) ), 'action=history' ) .
121 - ")</li>\n" );
122 - }
123 - $wgOut->addHTML( "</ul>\n$submit</form>" );
124 - }
125 -
126 - function getNewPages( $username ) {
127 - $dbr = wfGetDB( DB_SLAVE );
128 - $result = $dbr->select( 'recentchanges',
129 - array( 'rc_namespace', 'rc_title', 'rc_timestamp', 'COUNT(*) AS edits' ),
130 - array(
131 - 'rc_user_text' => $username,
132 - '(rc_new = 1) OR (rc_log_type = "upload" AND rc_log_action = "upload")'
133 - ),
134 - __METHOD__,
135 - array(
136 - 'ORDER BY' => 'rc_timestamp DESC',
137 - 'GROUP BY' => 'rc_namespace, rc_title'
138 - )
139 - );
140 - $pages = array();
141 - while( $row = $result->fetchObject() ) {
142 - $pages[] = array( Title::makeTitle( $row->rc_namespace, $row->rc_title ), $row->edits );
143 - }
144 - $result->free();
145 - return $pages;
146 - }
147 -
148 - function doDelete( $pages, $reason ) {
149 - foreach( $pages as $page ) {
150 - $title = Title::newFromUrl( $page );
151 - $file = $title->getNamespace() == NS_IMAGE ? wfLocalFile( $title ) : false;
152 - if ( $file ) {
153 - $oldimage = null; // Must be passed by reference
154 - FileDeleteForm::doDelete( $title, $file, $oldimage, $reason, false );
155 - } else {
156 - $article = new Article( $title );
157 - $article->doDelete( $reason );
158 - }
159 - }
160 - }
161 -}
Index: trunk/phase3/includes/DefaultSettings.php
@@ -1186,8 +1186,6 @@
11871187 $wgGroupPermissions['sysop']['apihighlimits'] = true;
11881188 $wgGroupPermissions['sysop']['browsearchive'] = true;
11891189 $wgGroupPermissions['sysop']['noratelimit'] = true;
1190 -$wgGroupPermissions['sysop']['nuke'] = true;
1191 -
11921190 #$wgGroupPermissions['sysop']['mergehistory'] = true;
11931191
11941192 // Permission to change users' group assignments
@@ -2862,7 +2860,6 @@
28632861 'Export' => 'pagetools',
28642862 'Import' => 'pagetools',
28652863 'Whatlinkshere' => 'pagetools',
2866 - 'Nuke' => 'pagetools',
28672864
28682865 'Statistics' => 'wiki',
28692866 'Version' => 'wiki',
Index: trunk/phase3/includes/SpecialPage.php
@@ -164,7 +164,6 @@
165165 'Listadmins' => array( 'SpecialRedirectToSpecial', 'Listadmins', 'Listusers', 'sysop' ),
166166 'MergeHistory' => array( 'SpecialPage', 'MergeHistory', 'mergehistory' ),
167167 'Listbots' => array( 'SpecialRedirectToSpecial', 'Listbots', 'Listusers', 'bot' ),
168 - 'Nuke' => 'SpecialNuke',
169168 );
170169
171170 static public $mAliases;
Index: trunk/phase3/includes/AutoLoader.php
@@ -478,7 +478,6 @@
479479 'SpecialBookSources' => 'includes/specials/SpecialBooksources.php',
480480 'SpecialListGroupRights' => 'includes/specials/SpecialListgrouprights.php',
481481 'SpecialMostlinkedtemplates' => 'includes/specials/SpecialMostlinkedtemplates.php',
482 - 'SpecialNuke' => 'includes/specials/SpecialNuke.php',
483482 'SpecialPrefixindex' => 'includes/specials/SpecialPrefixindex.php',
484483 'SpecialRandomredirect' => 'includes/specials/SpecialRandomredirect.php',
485484 'SpecialRecentchanges' => 'includes/specials/SpecialRecentchanges.php',
Index: trunk/phase3/languages/messages/MessagesHe.php
@@ -286,7 +286,6 @@
287287 'Blankpage' => array( 'דף_ריק' ),
288288 'LinkSearch' => array( 'חיפוש_קישורים_חיצוניים' ),
289289 'DeletedContributions' => array( 'תרומות_מחוקות' ),
290 - 'Nuke' => array( 'מחיקה_מרובה' ),
291290 );
292291
293292 $namespaceNames = array(
Index: trunk/phase3/languages/messages/MessagesAr.php
@@ -370,7 +370,6 @@
371371 'Blankpage' => array( 'صفحة_فارغة' ),
372372 'LinkSearch' => array( 'بحث_الوصلات' ),
373373 'DeletedContributions' => array( 'مساهمات_محذوفة' ),
374 - 'Nuke' => array( 'حذف_كمي' ),
375374 );
376375
377376 $imageFiles = array(
Index: trunk/phase3/languages/messages/MessagesEn.php
@@ -442,7 +442,6 @@
443443 'Blankpage' => array( 'BlankPage' ),
444444 'LinkSearch' => array( 'LinkSearch' ),
445445 'DeletedContributions' => array( 'DeletedContributions' ),
446 - 'Nuke' => array( 'Nuke' ),
447446 );
448447
449448 /**
@@ -3723,16 +3722,4 @@
37243723
37253724 #Put all regex fragments above this line. Leave this line exactly as it is</pre>',
37263725
3727 -# Special:Nuke
3728 -'nuke' => 'Mass delete',
3729 -'nuke-nopages' => 'No new pages by [[Special:Contributions/$1|$1]] in recent changes.',
3730 -'nuke-list' => 'The following pages were recently created by [[Special:Contributions/$1|$1]];
3731 -put in a comment and hit the button to delete them.',
3732 -'nuke-defaultreason' => 'Mass removal of pages added by $1',
3733 -'nuke-tools' => 'This tool allows for mass deletions of pages recently added by a given user or IP.
3734 -Input the username or IP to get a list of pages to delete.',
3735 -'nuke-submit-user' => 'Go',
3736 -'nuke-submit-delete' => 'Delete selected',
3737 -'right-nuke' => 'Mass delete pages',
3738 -
37393726 );
Index: trunk/phase3/languages/messages/MessagesArz.php
@@ -267,7 +267,6 @@
268268 'Blankpage' => array( 'صفحة_فارغة' ),
269269 'LinkSearch' => array( 'بحث_الوصلات' ),
270270 'DeletedContributions' => array( 'مساهمات_محذوفة' ),
271 - 'Nuke' => array( 'حذف_كمى' ),
272271 );
273272
274273 $messages = array(
Index: trunk/phase3/languages/messages/MessagesNo.php
@@ -163,7 +163,6 @@
164164 'Blankpage' => array( 'Blank side' ),
165165 'LinkSearch' => array( 'Lenkesøk' ),
166166 'DeletedContributions' => array( 'Slettede bidrag' ),
167 - 'Nuke' => array( 'Massesletting' ),
168167 );
169168
170169 $messages = array(
Index: trunk/phase3/languages/messages/MessagesNl.php
@@ -282,7 +282,6 @@
283283 'ListUserRestrictions' => array( 'Gebruikersbeperkingen' ),
284284 'RemoveRestrictions' => array( 'BeperkingenVerwijderen' ),
285285 'RestrictUser' => array( 'GebruikerBeperken' ),
286 - 'Nuke' => array( 'MassaalVerwijderen' ),
287286 );
288287
289288 $linkTrail = '/^([a-zäöüïëéèà]+)(.*)$/sDu';
Index: trunk/phase3/languages/messages/MessagesDe.php
@@ -158,7 +158,6 @@
159159 'Blankpage' => array( 'Leerseite' ),
160160 'LinkSearch' => array( 'Weblink-Suche' ),
161161 'DeletedContributions' => array( 'Gelöschte Beiträge' ),
162 - 'Nuke' => array( 'Massenlöschung' ),
163162 );
164163
165164 $datePreferences = array(
Index: trunk/phase3/languages/messages/MessagesNds_nl.php
@@ -251,7 +251,6 @@
252252 'Withoutinterwiki' => array( 'Gien_interwiki' ),
253253 'LinkSearch' => array( 'Verwiezingen_zeuken' ),
254254 'DeletedContributions' => array( 'Vort-ehaolen gebrukersbiedragen' ),
255 - 'Nuke' => array( 'Massaal_vortdoon' ),
256255 );
257256
258257 $linkTrail = '/^([a-zäöüïëéèà]+)(.*)$/sDu';
Index: trunk/phase3/RELEASE-NOTES
@@ -59,7 +59,6 @@
6060 * Special:LinkSearch to search for external links (was extension LinkSearch)
6161 * RenderHash
6262 * NoMoveUserPages
63 -* Special:Nuke to mass delete all pages created by a user
6463 * Poem (patch by Nathaniel Herman)
6564 * UniversalEditButton
6665
Index: trunk/phase3/maintenance/language/messages.inc
@@ -2810,16 +2810,6 @@
28112811 'external_images' => array(
28122812 'external_image_whitelist',
28132813 ),
2814 - 'special-nuke' => array(
2815 - 'nuke',
2816 - 'nuke-nopages',
2817 - 'nuke-list',
2818 - 'nuke-defaultreason',
2819 - 'nuke-tools',
2820 - 'nuke-submit-user',
2821 - 'nuke-submit-delete',
2822 - 'right-nuke',
2823 - ),
28242814 );
28252815
28262816 /** Comments for each block */
@@ -3015,7 +3005,6 @@
30163006 'special-specialpages' => 'Special:SpecialPages',
30173007 'special-blank' => 'Special:BlankPage',
30183008 'external_images' => 'External image whitelist',
3019 - 'special-nuke' => 'Special:Nuke',
30203009 );
30213010
30223011 /** Short comments for standalone messages */

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r41630* Add functionality of extension Nuke to core. Messages for other languages w...siebrand00:33, 4 October 2008

Status & tagging log