37 private $propName =
null;
42 private $existingPropNames =
null;
52 private $reverse =
false;
57 private $sortByValue =
false;
63 parent::__construct(
'PagesWithProp' );
74 $this->
getOutput()->addModuleStyles(
'mediawiki.special' );
77 $propname = $request->getVal(
'propname', $par );
78 $this->ns = $request->getIntOrNull(
'namespace' );
79 $this->reverse = $request->getBool(
'reverse' );
80 $this->sortByValue = $request->getBool(
'sortbyvalue' );
88 'options' => $propnames,
89 'default' => $propname,
90 'label-message' =>
'pageswithprop-prop',
94 'type' =>
'namespaceselect',
95 'name' =>
'namespace',
96 'label-message' =>
'namespace',
98 'default' => $this->ns,
103 'default' => $this->reverse,
104 'label-message' =>
'pageswithprop-reverse',
109 'name' =>
'sortbyvalue',
110 'default' => $this->sortByValue,
111 'label-message' =>
'pageswithprop-sortbyvalue',
116 $form = HTMLForm::factory(
'ooui', $fields, $this->
getContext() )
119 ->setSubmitCallback( [ $this,
'onSubmit' ] )
120 ->setWrapperLegendMsg(
'pageswithprop-legend' )
121 ->addHeaderText( $this->
msg(
'pageswithprop-text' )->parseAsBlock() )
122 ->setSubmitTextMsg(
'pageswithprop-submit' )
124 $form->displayForm(
false );
125 if ( $propname !==
'' && $propname !==
null ) {
131 $this->propName = $data[
'propname'];
132 parent::execute( $data[
'propname'] );
162 'reverse' => $this->reverse,
163 'sortbyvalue' => $this->sortByValue,
165 if ( $this->ns !==
null ) {
166 $params[
'namespace'] = $this->ns;
173 'tables' => [
'page_props',
'page' ],
175 'page_id' =>
'pp_page',
184 'pp_propname' => $this->propName,
187 'page' => [
'JOIN',
'page_id = pp_page' ]
192 if ( $this->ns !==
null ) {
193 $query[
'conds'][
'page_namespace'] = $this->ns;
200 $sort = [
'page_id' ];
201 if ( $this->sortByValue ) {
202 array_unshift( $sort,
'pp_sortkey' );
211 return !$this->reverse;
220 $title = Title::newFromRow( $result );
222 if ( $result->pp_value !==
'' ) {
224 $valueLength = strlen( $result->pp_value );
225 $isBinary = strpos( $result->pp_value,
"\0" ) !==
false;
226 $isTooLong = $valueLength > 1024;
228 if ( $isBinary || $isTooLong ) {
230 ->msg( $isBinary ?
'pageswithprop-prophidden-binary' :
'pageswithprop-prophidden-long' )
231 ->sizeParams( $valueLength );
233 $propValue = Html::element(
'span', [
'class' =>
'prop-value-hidden' ], $message->text() );
235 $propValue = Html::element(
'span', [
'class' =>
'prop-value' ], $result->pp_value );
238 $ret .= $this->
msg(
'colon-separator' )->escaped() . $propValue;
245 if ( $this->existingPropNames ===
null ) {
248 return $this->existingPropNames;
253 'DISTINCT',
'ORDER BY' =>
'pp_propname'
272 foreach (
$res as $row ) {
273 $propnames[$row->pp_propname] = $row->pp_propname;
This is a class for doing query pages; since they're almost all the same, we factor out some of the f...
setDBLoadBalancer(ILoadBalancer $loadBalancer)
int $offset
The offset and limit in use, as passed to the query() function.
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
getOutput()
Get the OutputPage being used for this instance.
static prefixSearchArray( $search, $limit, array $subpages, $offset)
Helper function for implementations of prefixSearchSubpages() that filter the values in memory (as op...
getContext()
Gets the context this SpecialPage is executed in.
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
getRequest()
Get the WebRequest being used for this instance.
getPageTitle( $subpage=false)
Get a self-referential title object.
Special:PagesWithProp to search the page_props table.
execute( $par)
This is the actual workhorse.
linkParameters()
If using extra form wheely-dealies, return a set of parameters here as an associative array....
queryExistingProps( $limit=null, $offset=0)
getQueryInfo()
Subclasses return an SQL query here, formatted as an array with the following keys: tables => Table(s...
isSyndicated()
Disable RSS/Atom feeds.
isCacheable()
Is the output of this query cacheable? Non-cacheable expensive pages will be disabled in miser mode a...
getOrderFields()
Subclasses return an array of fields to order by here.
__construct(ILoadBalancer $loadBalancer)
prefixSearchSubpages( $search, $limit, $offset)
Return an array of subpages beginning with $search that this special page will accept.
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
formatResult( $skin, $result)