From 1a438df4496bcc22f61bce8aa092c6f331fe809c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bartosz=20Dziewo=C5=84ski?= Date: Fri, 11 Oct 2013 21:42:23 +0200 Subject: [PATCH] SpecialWatchlist: Remove dead cutoff code Added back in r1532, it got broken in one of the numerous refactors since then and now only triggers when 'days' request parameter is passed explicitly and is malformed. Just use floatval() instead. Change-Id: I20c1e816a11fca5037af93bf81b46839f2a5efb0 --- includes/specials/SpecialWatchlist.php | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/includes/specials/SpecialWatchlist.php b/includes/specials/SpecialWatchlist.php index 59f0dfedc0..6987f6fcaf 100644 --- a/includes/specials/SpecialWatchlist.php +++ b/includes/specials/SpecialWatchlist.php @@ -100,7 +100,7 @@ class SpecialWatchlist extends SpecialPage { // @todo use FormOptions! $defaults = array( - /* float */ 'days' => floatval( $user->getOption( 'watchlistdays' ) ), /* 3.0 or 0.5, watch further below */ + /* float */ 'days' => floatval( $user->getOption( 'watchlistdays' ) ), /* bool */ 'hideMinor' => (int)$user->getBoolOption( 'watchlisthideminor' ), /* bool */ 'hideBots' => (int)$user->getBoolOption( 'watchlisthidebots' ), /* bool */ 'hideAnons' => (int)$user->getBoolOption( 'watchlisthideanons' ), @@ -121,7 +121,7 @@ class SpecialWatchlist extends SpecialPage { # Extract variables from the request, falling back to user preferences or # other default values if these don't exist $values = array(); - $values['days'] = $request->getVal( 'days', $defaults['days'] ); + $values['days'] = floatval( $request->getVal( 'days', $defaults['days'] ) ); $values['hideMinor'] = (int)$request->getBool( 'hideMinor', $defaults['hideMinor'] ); $values['hideBots'] = (int)$request->getBool( 'hideBots', $defaults['hideBots'] ); $values['hideAnons'] = (int)$request->getBool( 'hideAnons', $defaults['hideAnons'] ); @@ -158,18 +158,6 @@ class SpecialWatchlist extends SpecialPage { $values['invert'] = $invert; $values['associated'] = $associated; - if ( is_null( $values['days'] ) || !is_numeric( $values['days'] ) ) { - $big = 1000; /* The magical big */ - if ( $nitems > $big ) { - # Set default cutoff shorter - $values['days'] = $defaults['days'] = ( 12.0 / 24.0 ); # 12 hours... - } else { - $values['days'] = $defaults['days']; # default cutoff for shortlisters - } - } else { - $values['days'] = floatval( $values['days'] ); - } - // Dump everything here $nondefaults = array(); foreach ( $defaults as $name => $defValue ) { -- 2.20.1