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
This commit is contained in:
Daimona Eaytoy 2018-05-21 12:11:45 +02:00
parent 0804a7ea12
commit ba9df944c8

View file

@ -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',