From dd9328185fb5c294b321f52d46f1b5ab3ae6cea1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Mat=C4=9Bj=20Such=C3=A1nek?= Date: Fri, 20 Sep 2019 11:41:58 +0200 Subject: [PATCH] Fix namespace handling on Special:PagesWithProp Firstly, restore the availability to query all namespaces. There is no reason to remove this feature. Secondly, fix code not to treat '0' as falsy. Instead, use the request object to get an integer or null. Bug: T50247 Change-Id: I182e25be2d694d010a1e8382a461c5c08f898581 --- includes/specials/SpecialPagesWithProp.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/includes/specials/SpecialPagesWithProp.php b/includes/specials/SpecialPagesWithProp.php index 527b910fcf..8d6488de0a 100644 --- a/includes/specials/SpecialPagesWithProp.php +++ b/includes/specials/SpecialPagesWithProp.php @@ -40,7 +40,7 @@ class SpecialPagesWithProp extends QueryPage { private $existingPropNames = null; /** - * @var string|null + * @var int|null */ private $ns; @@ -69,6 +69,7 @@ class SpecialPagesWithProp extends QueryPage { $request = $this->getRequest(); $propname = $request->getVal( 'propname', $par ); + $this->ns = $request->getIntOrNull( 'namespace' ); $this->reverse = $request->getBool( 'reverse' ); $this->sortByValue = $request->getBool( 'sortbyvalue' ); @@ -87,8 +88,8 @@ class SpecialPagesWithProp extends QueryPage { 'type' => 'namespaceselect', 'name' => 'namespace', 'label-message' => 'namespace', - 'all' => null, - 'default' => null, + 'all' => '', + 'default' => $this->ns, ], 'reverse' => [ 'type' => 'check', @@ -120,7 +121,6 @@ class SpecialPagesWithProp extends QueryPage { public function onSubmit( $data, $form ) { $this->propName = $data['propname']; - $this->ns = $data['namespace']; parent::execute( $data['propname'] ); } @@ -167,7 +167,7 @@ class SpecialPagesWithProp extends QueryPage { 'options' => [] ]; - if ( $this->ns && isset( $this->ns ) ) { + if ( $this->ns !== null ) { $query['conds']['page_namespace'] = $this->ns; } -- 2.20.1