jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/232698 )

Change subject: New parameters 'reverse' and 'sortbyvalue' for 
Special:PagesWithProp
......................................................................


New parameters 'reverse' and 'sortbyvalue' for Special:PagesWithProp

Bug: T66950
Change-Id: Idc31289b1a9dd4746b2ecd502a23b182210384d8
---
M includes/specials/SpecialPagesWithProp.php
M languages/i18n/en.json
M languages/i18n/qqq.json
3 files changed, 50 insertions(+), 1 deletion(-)

Approvals:
  Daniel Kinzler: Looks good to me, approved
  Aleksey Bekh-Ivanov (WMDE): Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/includes/specials/SpecialPagesWithProp.php 
b/includes/specials/SpecialPagesWithProp.php
index 5878e1f..34fcc78 100644
--- a/includes/specials/SpecialPagesWithProp.php
+++ b/includes/specials/SpecialPagesWithProp.php
@@ -28,8 +28,26 @@
  * @since 1.21
  */
 class SpecialPagesWithProp extends QueryPage {
+
+       /**
+        * @var string|null
+        */
        private $propName = null;
+
+       /**
+        * @var string[]|null
+        */
        private $existingPropNames = null;
+
+       /**
+        * @var bool
+        */
+       private $reverse = false;
+
+       /**
+        * @var bool
+        */
+       private $sortByValue = false;
 
        function __construct( $name = 'PagesWithProp' ) {
                parent::__construct( $name );
@@ -46,6 +64,8 @@
 
                $request = $this->getRequest();
                $propname = $request->getVal( 'propname', $par );
+               $this->reverse = $request->getBool( 'reverse' );
+               $this->sortByValue = $request->getBool( 'sortbyvalue' );
 
                $propnames = $this->getExistingPropNames();
 
@@ -58,6 +78,20 @@
                                'label-message' => 'pageswithprop-prop',
                                'required' => true,
                        ],
+                       'reverse' => [
+                               'type' => 'check',
+                               'name' => 'reverse',
+                               'default' => $this->reverse,
+                               'label-message' => 'pageswithprop-reverse',
+                               'required' => false,
+                       ],
+                       'sortbyvalue' => [
+                               'type' => 'check',
+                               'name' => 'sortbyvalue',
+                               'default' => $this->sortByValue,
+                               'label-message' => 'pageswithprop-sortbyvalue',
+                               'required' => false,
+                       ]
                ], $this->getContext() );
                $form->setMethod( 'get' );
                $form->setSubmitCallback( [ $this, 'onSubmit' ] );
@@ -122,7 +156,18 @@
        }
 
        function getOrderFields() {
-               return [ 'page_id' ];
+               $sort = [ 'page_id' ];
+               if ( $this->sortByValue ) {
+                       array_unshift( $sort, 'pp_sortkey' );
+               }
+               return $sort;
+       }
+
+       /**
+        * @return bool
+        */
+       public function sortDescending() {
+               return !$this->reverse;
        }
 
        /**
diff --git a/languages/i18n/en.json b/languages/i18n/en.json
index 929042f..c87a676 100644
--- a/languages/i18n/en.json
+++ b/languages/i18n/en.json
@@ -1851,6 +1851,8 @@
        "pageswithprop-legend": "Pages with a page property",
        "pageswithprop-text": "This page lists pages that use a particular page 
property.",
        "pageswithprop-prop": "Property name:",
+       "pageswithprop-reverse": "Sort in reverse order",
+       "pageswithprop-sortbyvalue": "Sort by property value",
        "pageswithprop-submit": "Go",
        "pageswithprop-prophidden-long": "long text property value hidden ($1)",
        "pageswithprop-prophidden-binary": "binary property value hidden ($1)",
diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json
index 719f413..8937aec 100644
--- a/languages/i18n/qqq.json
+++ b/languages/i18n/qqq.json
@@ -2041,6 +2041,8 @@
        "pageswithprop-legend": "Legend for the input form on 
[[Special:PagesWithProp]].\n{{Identical|Page with page property}}",
        "pageswithprop-text": "Introductory text for the input form on 
[[Special:PagesWithProp]]",
        "pageswithprop-prop": "Label for the property name input field on 
[[Special:PagesWithProp]].\n{{Identical|Property name}}",
+       "pageswithprop-reverse": "Label for the reverse checkmark field on 
[[Special:PagesWithProp]].",
+       "pageswithprop-sortbyvalue": "Label for the sort by value checkmark 
field on [[Special:PagesWithProp]].",
        "pageswithprop-submit": "Label for the submit button on 
[[Special:PagesWithProp]].\n{{Identical|Go}}",
        "pageswithprop-prophidden-long": "Information shown on 
[[Special:PagesWithProp]] when property value is longer than 1 
kilobyte.\n\nParameters:\n* $1 - size of property value in kilobytes\nSee 
also:\n* {{msg-mw|pageswithprop-prophidden-binary}}",
        "pageswithprop-prophidden-binary": "Information shown on 
[[Special:PagesWithProp]] when property value contains binary 
data.\n\nParameters:\n* $1 - size of property value in kilobytes\nSee also:\n* 
{{msg-mw|pageswithprop-prophidden-long}}",

-- 
To view, visit https://gerrit.wikimedia.org/r/232698
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Idc31289b1a9dd4746b2ecd502a23b182210384d8
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Ricordisamoa <[email protected]>
Gerrit-Reviewer: Aleksey Bekh-Ivanov (WMDE) <[email protected]>
Gerrit-Reviewer: Daniel Kinzler <[email protected]>
Gerrit-Reviewer: Hoo man <[email protected]>
Gerrit-Reviewer: Ladsgroup <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Thiemo Mättig (WMDE) <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to