From: Prateek Saxena Date: Thu, 19 Jul 2018 05:02:24 +0000 (+0530) Subject: LogPager: Add backwards-compatibility for hide_[type]_log URL params X-Git-Tag: 1.34.0-rc.0~4677^2 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dcompta/comptes/journal.php?a=commitdiff_plain;h=8aaa50b6ef3362acc6662c536e7fbc641d485236;p=lhc%2Fweb%2Fwiklou.git 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 --- 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 );