From 8aaa50b6ef3362acc6662c536e7fbc641d485236 Mon Sep 17 00:00:00 2001 From: Prateek Saxena Date: Thu, 19 Jul 2018 10:32:24 +0530 Subject: [PATCH] LogPager: Add backwards-compatibility for hide_[type]_log URL params Also, the $default value in LogEventsList#getFiltersDesc was not being generated properly and would have always been an empty array. Bug: T199856 Change-Id: Id286c76259406521f12cda67a4a715032e022637 --- includes/logging/LogEventsList.php | 2 +- includes/logging/LogPager.php | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/includes/logging/LogEventsList.php b/includes/logging/LogEventsList.php index 95439b9c77..7462dbf01d 100644 --- a/includes/logging/LogEventsList.php +++ b/includes/logging/LogEventsList.php @@ -198,7 +198,7 @@ class LogEventsList extends ContextSource { foreach ( $filter as $type => $val ) { $options[ $this->msg( "logeventslist-{$type}-log" )->text() ] = $type; - if ( $val === 0 ) { + if ( $val === false ) { $default[] = $type; } } diff --git a/includes/logging/LogPager.php b/includes/logging/LogPager.php index 2efb462b90..e7096c460a 100644 --- a/includes/logging/LogPager.php +++ b/includes/logging/LogPager.php @@ -107,12 +107,17 @@ class LogPager extends ReverseChronologicalPager { return $filters; } - $request_filters = $this->getRequest()->getArray( "wpfilters" ); - $request_filters = $request_filters === null ? [] : $request_filters; + $wpfilters = $this->getRequest()->getArray( "wpfilters" ); + $request_filters = $wpfilters === null ? [] : $wpfilters; foreach ( $wgFilterLogTypes as $type => $default ) { $hide = !in_array( $type, $request_filters ); + // Back-compat: Check old URL params if the new param wasn't passed + if ( $wpfilters === null ) { + $hide = $this->getRequest()->getBool( "hide_{$type}_log", $default ); + } + $filters[$type] = $hide; if ( $hide ) { $this->mConds[] = 'log_type != ' . $this->mDb->addQuotes( $type ); -- 2.20.1