* @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 );
}
$request = $this->getRequest();
$propname = $request->getVal( 'propname', $par );
+ $this->reverse = $request->getBool( 'reverse' );
+ $this->sortByValue = $request->getBool( 'sortbyvalue' );
$propnames = $this->getExistingPropNames();
'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' ] );
}
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;
}
/**
"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)",
"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}}",