r100182 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r100181‎ | r100182 | r100183 >
Date:22:46, 18 October 2011
Author:jeroendedauw
Status:ok (Comments)
Tags:
Comment:
Follow up to r82136;
Modified paths:
  • /trunk/extensions/Nuke/Nuke.i18n.php (modified) (history)
  • /trunk/extensions/Nuke/Nuke.php (modified) (history)
  • /trunk/extensions/Nuke/Nuke_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Nuke/Nuke_body.php
@@ -17,41 +17,44 @@
1818 $this->setHeaders();
1919 $this->outputHeader();
2020
21 - if( $wgRequest->wasPosted() && $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ) ) {
22 - $target = $wgRequest->getText( 'target', $par );
 21+ $target = trim( $wgRequest->getText( 'target', $par ) );
 22+
 23+ // Normalise name
 24+ if ( $target !== '' ) {
 25+ $user = User::newFromName( $target );
 26+ if ( $user ) $target = $user->getName();
 27+ }
 28+
 29+ $reason = $wgRequest->getText(
 30+ 'wpReason',
 31+ wfMsgForContent(
 32+ 'nuke-defaultreason',
 33+ $target === '' ? wfMsg( 'nuke-multiplepeople' ) : $target
 34+ )
 35+ );
 36+
 37+ if( $wgRequest->wasPosted()
 38+ && $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) )
 39+ && $wgRequest->getVal( 'action' ) == 'delete' ) {
 40+
 41+ $pages = $wgRequest->getArray( 'pages' );
2342
24 - // Normalise name
25 - if ( $target !== '' ) {
26 - $user = User::newFromName( $target );
27 - if ( $user ) $target = $user->getName();
 43+ if( $pages ) {
 44+ return $this->doDelete( $pages, $reason );
2845 }
29 -
30 - $reason = $wgRequest->getText(
31 - 'wpReason',
32 - wfMsgForContent(
33 - 'nuke-defaultreason',
34 - $target === '' ? wfMsg( 'nuke-multiplepeople' ) : $target
35 - )
36 - );
37 -
38 - if ( $wgRequest->getVal( 'action' ) == 'delete' ) {
39 - $pages = $wgRequest->getArray( 'pages' );
40 -
41 - if( $pages ) {
42 - return $this->doDelete( $pages, $reason );
43 - }
44 - } else {
45 - $this->listForm( $target, $reason, $wgRequest->getInt( 'limit' ) );
46 - }
47 - } else {
 46+ }
 47+ else if ( $target === '' ) {
4848 $this->promptForm();
4949 }
 50+ else {
 51+ $this->listForm( $target, $reason, $wgRequest->getInt( 'limit', 500 ) );
 52+ }
5053 }
5154
5255 /**
5356 * Prompt for a username or IP address.
5457 */
55 - protected function promptForm() {
 58+ protected function promptForm( $userName = '' ) {
5659 global $wgOut, $wgUser;
5760
5861 $wgOut->addWikiMsg( 'nuke-tools' );
@@ -66,7 +69,7 @@
6770 )
6871 . '<table><tr>'
6972 . '<td>' . htmlspecialchars( wfMsg( 'nuke-userorip' ) ) . '</td>'
70 - . '<td>' . Xml::input( 'target', 40 ) . '</td>'
 73+ . '<td>' . Xml::input( 'target', 40, $userName ) . '</td>'
7174 . '</tr><tr>'
7275 . '<td>' . htmlspecialchars( wfMsg( 'nuke-maxpages' ) ) . '</td>'
7376 . '<td>' . Xml::input( 'limit', 7, '500' ) . '</td>'
@@ -93,7 +96,7 @@
9497
9598 if( count( $pages ) == 0 ) {
9699 $wgOut->addWikiMsg( 'nuke-nopages', $username );
97 - return $this->promptForm();
 100+ return $this->promptForm( $username );
98101 }
99102
100103 if ( $username == '' ) {
@@ -257,6 +260,10 @@
258261 $res[] = wfMsgExt( 'nuke-not-deleted', array( 'parseinline' ), $title->getPrefixedText() );
259262 }
260263 }
 264+
261265 $wgOut->addHTML( "<ul>\n<li>" . implode( "</li>\n<li>", $res ) . "</li>\n</ul>\n" );
 266+
 267+ $wgOut->addWikiMsg( 'nuke-delete-more' );
262268 }
 269+
263270 }
Index: trunk/extensions/Nuke/Nuke.i18n.php
@@ -33,6 +33,7 @@
3434 'nuke-editby' => 'Created by [[Special:Contributions/$1|$1]]',
3535 'nuke-deleted' => "Page '''$1''' has been deleted.",
3636 'nuke-not-deleted' => "Page [[:$1]] '''could not''' be deleted.",
 37+ 'nuke-delete-more' => '[[Special:Nuke|Delete more pages]]',
3738 );
3839
3940 /** Message documentation (Message documentation)
Index: trunk/extensions/Nuke/Nuke.php
@@ -4,7 +4,7 @@
55 die( 'Not an entry point.' );
66 }
77
8 -define( 'Nuke_VERSION', '1.1' );
 8+define( 'Nuke_VERSION', '1.1.1' );
99
1010 $dir = dirname(__FILE__) . '/';
1111

Follow-up revisions

RevisionCommit summaryAuthorDate
r107974MFT r100182reedy00:29, 4 January 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r82136Added a changable limit and the option to not filter the recent changes on a ...jeroendedauw20:21, 14 February 2011

Comments

#Comment by 😂 (talk | contribs)   21:55, 8 November 2011
  • Minor tab/space confusion in i18n file
  • In the future, could you say what you're fixing in addition to the rev you're fixing so I don't have to dig through the old revision comments as deeply to figure it out :)
#Comment by Reedy (talk | contribs)   23:27, 9 November 2011

Does this need to be 1.18wmf1'd?

IFf so, r82136 needs reviewing and merging first

#Comment by MaxSem (talk | contribs)   05:22, 28 November 2011

Status & tagging log