It is a duplicate of $defaults, so instead of calling $user->get(Bool)Option()
one more time, use the already-present value in $defaults.
I know that boolean values in $defaults are casted to integer, but
WebRequest::getBool() simply casts the result of getVal() to boolean,
so there is no problem with this.
Change-Id: I2965c8c82b8cd8bfc8dee5d81a2bfa8af9e8131f
# Extract variables from the request, falling back to user preferences or
# other default values if these don't exist
# Extract variables from the request, falling back to user preferences or
# other default values if these don't exist
- $prefs['days'] = floatval( $user->getOption( 'watchlistdays' ) );
- $prefs['hideminor'] = $user->getBoolOption( 'watchlisthideminor' );
- $prefs['hidebots'] = $user->getBoolOption( 'watchlisthidebots' );
- $prefs['hideanons'] = $user->getBoolOption( 'watchlisthideanons' );
- $prefs['hideliu'] = $user->getBoolOption( 'watchlisthideliu' );
- $prefs['hideown'] = $user->getBoolOption( 'watchlisthideown' );
- $prefs['hidepatrolled'] = $user->getBoolOption( 'watchlisthidepatrolled' );
- $prefs['extended'] = $user->getBoolOption( 'extendwatchlist' );
-
- # Get query variables
- $values['days'] = $request->getVal( 'days', $prefs['days'] );
- $values['hideMinor'] = (int)$request->getBool( 'hideMinor', $prefs['hideminor'] );
- $values['hideBots'] = (int)$request->getBool( 'hideBots', $prefs['hidebots'] );
- $values['hideAnons'] = (int)$request->getBool( 'hideAnons', $prefs['hideanons'] );
- $values['hideLiu'] = (int)$request->getBool( 'hideLiu', $prefs['hideliu'] );
- $values['hideOwn'] = (int)$request->getBool( 'hideOwn', $prefs['hideown'] );
- $values['hidePatrolled'] = (int)$request->getBool( 'hidePatrolled', $prefs['hidepatrolled'] );
- $values['extended'] = (int)$request->getBool( 'extended', $prefs['extended'] );
+ $values['days'] = $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'] );
+ $values['hideLiu'] = (int)$request->getBool( 'hideLiu', $defaults['hideLiu'] );
+ $values['hideOwn'] = (int)$request->getBool( 'hideOwn', $defaults['hideOwn'] );
+ $values['hidePatrolled'] = (int)$request->getBool( 'hidePatrolled', $defaults['hidePatrolled'] );
+ $values['extended'] = (int)$request->getBool( 'extended', $defaults['extended'] );
foreach( $this->customFilters as $key => $params ) {
$values[$key] = (int)$request->getBool( $key );
}
foreach( $this->customFilters as $key => $params ) {
$values[$key] = (int)$request->getBool( $key );
}