From: Matěj Suchánek Date: Fri, 20 Sep 2019 09:41:58 +0000 (+0200) Subject: Fix namespace handling on Special:PagesWithProp X-Git-Tag: 1.34.0-rc.0~141^2 X-Git-Url: http://git.cyclocoop.org/%22%22._DIR_PLUGIN_FULLCALENDAR.%22prive/themes/spip/images/event_edit.png/favicon.ico?a=commitdiff_plain;h=dd9328185fb5c294b321f52d46f1b5ab3ae6cea1;p=lhc%2Fweb%2Fwiklou.git 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 --- 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; }