From ba9df944c8a7be0cc9266140905e68550f5ae69f Mon Sep 17 00:00:00 2001 From: Daimona Eaytoy Date: Mon, 21 May 2018 12:11:45 +0200 Subject: [PATCH] Compare with null instead of using $config->has With I91a9c5cca55e540a6c95b750579c1c369a760b15 we replaced some globals with Config and, in doing this, we added "$config->has()" to check if a variable was null. However, "has" will always return true even if the value is null (it only checks if it exists), and thus we end up showing a global abusefilter pager even if no central DB is set. Bug: T195022 Change-Id: I751fdefd29b6af1361021d4343ba67f16c99a037 --- includes/Views/AbuseFilterViewList.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/includes/Views/AbuseFilterViewList.php b/includes/Views/AbuseFilterViewList.php index ed5629f66..c8391bcba 100644 --- a/includes/Views/AbuseFilterViewList.php +++ b/includes/Views/AbuseFilterViewList.php @@ -32,7 +32,7 @@ class AbuseFilterViewList extends AbuseFilterView { $deleted = $request->getVal( 'deletedfilters' ); $hidedisabled = $request->getBool( 'hidedisabled' ); $defaultscope = 'all'; - if ( $config->has( 'AbuseFilterCentralDB' ) + if ( $config->get( 'AbuseFilterCentralDB' ) !== null && !$config->get( 'AbuseFilterIsCentral' ) ) { // Show on remote wikis as default only local filters $defaultscope = 'local'; @@ -40,7 +40,7 @@ class AbuseFilterViewList extends AbuseFilterView { $scope = $request->getVal( 'rulescope', $defaultscope ); $searchEnabled = $this->canViewPrivate() && !( - $config->has( 'AbuseFilterCentralDB' ) && + $config->get( 'AbuseFilterCentralDB' ) !== null && !$config->get( 'AbuseFilterIsCentral' ) && $scope == 'global' ); @@ -141,7 +141,7 @@ class AbuseFilterViewList extends AbuseFilterView { } if ( - $config->has( 'AbuseFilterCentralDB' ) + $config->get( 'AbuseFilterCentralDB' ) !== null && !$config->get( 'AbuseFilterIsCentral' ) && $scope == 'global' ) { @@ -174,7 +174,7 @@ class AbuseFilterViewList extends AbuseFilterView { 'default' => $deleted, ]; - if ( $config->has( 'AbuseFilterCentralDB' ) ) { + if ( $config->get( 'AbuseFilterCentralDB' ) !== null ) { $optionsMsg = [ 'abusefilter-list-options-scope-local' => 'local', 'abusefilter-list-options-scope-global' => 'global',