r43099 - Code Review

From MediaWiki.org

Jump to: navigation, search
Repository:MediaWiki
Revision:r43098 | r43099 (on ViewVC) | r43100 >
Date:22:58, 2 November 2008
Author:siebrand
Status:ok
Tags:
Comment:(bug 16113) Show/hide for redirects in Special:NewPages. Patch by Paul Copperman
Modified paths:

Diff [purge]

Index: trunk/phase3/maintenance/language/messages.inc
===================================================================
--- trunk/phase3/maintenance/language/messages.inc	(revision 43098)
+++ trunk/phase3/maintenance/language/messages.inc	(revision 43099)
@@ -1363,6 +1363,7 @@
 		'newpages',
 		'newpages-summary',
 		'newpages-username',
+		'newpages-showhideredirs',
 		'ancientpages',
 		'ancientpages-summary',
 		'move',
Index: trunk/phase3/CREDITS
===================================================================
--- trunk/phase3/CREDITS	(revision 43098)
+++ trunk/phase3/CREDITS	(revision 43099)
@@ -58,6 +58,7 @@
 * Mormegil
 * Nathaniel Herman
 * Nathan Larson
+* Paul Copperman
 * RememberTheDot
 * ST47
 
Index: trunk/phase3/includes/specials/SpecialNewpages.php
===================================================================
--- trunk/phase3/includes/specials/SpecialNewpages.php	(revision 43098)
+++ trunk/phase3/includes/specials/SpecialNewpages.php	(revision 43099)
@@ -26,6 +26,7 @@
 		$opts->add( 'hideliu', false );
 		$opts->add( 'hidepatrolled', false );
 		$opts->add( 'hidebots', false );
+		$opts->add( 'hideredirs', true );
 		$opts->add( 'limit', (int)$wgUser->getOption( 'rclimit' ) );
 		$opts->add( 'offset', '' );
 		$opts->add( 'namespace', '0' );
@@ -58,6 +59,8 @@
 				$this->opts->setValue( 'hidepatrolled', true );
 			if ( 'hidebots' == $bit )
 				$this->opts->setValue( 'hidebots', true );
+			if ( 'showredirs' == $bit )
+				$this->opts->setValue( 'hideredirs', false );
 			if ( is_numeric( $bit ) )
 				$this->opts->setValue( 'limit', intval( $bit ) );
 
@@ -125,7 +128,8 @@
 		$filters = array(
 			'hideliu' => 'rcshowhideliu',
 			'hidepatrolled' => 'rcshowhidepatr',
-			'hidebots' => 'rcshowhidebots'
+			'hidebots' => 'rcshowhidebots',
+			'hideredirs' => 'newpages-showhideredirs'
 		);
 
 		// Disable some if needed
@@ -142,8 +146,8 @@
 		$self = $this->getTitle();
 		foreach ( $filters as $key => $msg ) {
 			$onoff = 1 - $this->opts->getValue($key);
-			$link = $this->skin->makeKnownLinkObj( $self, $showhide[$onoff],
-				wfArrayToCGI( array( $key => $onoff ), $changed )
+			$link = $this->skin->link( $self, $showhide[$onoff], array(),
+				 array( $key => $onoff ) + $changed
 			);
 			$links[$key] = wfMsgHtml( $msg, $link );
 		}
@@ -348,8 +352,6 @@
 	// Stored opts
 	protected $opts, $mForm;
 
-	private $hideliu, $hidepatrolled, $hidebots, $namespace, $user, $spTitle;
-
 	function __construct( $form, FormOptions $opts ) {
 		parent::__construct();
 		$this->mForm = $form;
@@ -381,7 +383,7 @@
 			$rcIndexes = array( 'rc_timestamp' );
 		}
 		$conds[] = 'page_id = rc_cur_id';
-		$conds['page_is_redirect'] = 0;
+
 		# $wgEnableNewpagesUserFilter - temp WMF hack
 		if( $wgEnableNewpagesUserFilter && $user ) {
 			$conds['rc_user_text'] = $user->getText();
@@ -398,6 +400,10 @@
 			$conds['rc_bot'] = 0;
 		}
 
+		if ( $this->opts->getValue( 'hideredirs' ) ) {
+			$conds['page_is_redirect'] = 0;
+		}
+
 		return array(
 			'tables' => array( 'recentchanges', 'page' ),
 			'fields' => 'rc_namespace,rc_title, rc_cur_id, rc_user,rc_user_text,rc_comment,
Index: trunk/phase3/languages/messages/MessagesEn.php
===================================================================
--- trunk/phase3/languages/messages/MessagesEn.php	(revision 43098)
+++ trunk/phase3/languages/messages/MessagesEn.php	(revision 43099)
@@ -2095,6 +2095,7 @@
 'newpages'                        => 'New pages',
 'newpages-summary'                => '', # do not translate or duplicate this message to other languages
 'newpages-username'               => 'Username:',
+'newpages-showhideredirs'         => '$1 redirects',
 'ancientpages'                    => 'Oldest pages',
 'ancientpages-summary'            => '', # do not translate or duplicate this message to other languages
 'move'                            => 'Move',
Index: trunk/phase3/RELEASE-NOTES
===================================================================
--- trunk/phase3/RELEASE-NOTES	(revision 43098)
+++ trunk/phase3/RELEASE-NOTES	(revision 43099)
@@ -188,6 +188,7 @@
 * (bug 13710) Allow to force "watch this" checkbox via URL using para "watchthis"
 * (bug 15125) Add Public Domain to default options when installing. Patch by Nathan Larson.
 * Set a special temporary directory for ImageMagick with $wgImageMagickTempDir
+* (bug 16113) Show/hide for redirects in Special:NewPages
 
 === Bug fixes in 1.14 ===
 
Views
Toolbox