58 parent::__construct( $name );
68 $this->
getOutput()->addModuleStyles(
'mediawiki.special' );
71 $propname = $request->getVal(
'propname', $par );
72 $this->ns = $request->getIntOrNull(
'namespace' );
73 $this->reverse = $request->getBool(
'reverse' );
74 $this->sortByValue = $request->getBool(
'sortbyvalue' );
82 'options' => $propnames,
83 'default' => $propname,
84 'label-message' =>
'pageswithprop-prop',
88 'type' =>
'namespaceselect',
89 'name' =>
'namespace',
90 'label-message' =>
'namespace',
98 'label-message' =>
'pageswithprop-reverse',
103 'name' =>
'sortbyvalue',
105 'label-message' =>
'pageswithprop-sortbyvalue',
112 $form = HTMLForm::factory(
'ooui', $fields, $context );
114 $form->setMethod(
'get' );
115 $form->setSubmitCallback( [ $this,
'onSubmit' ] );
116 $form->setWrapperLegendMsg(
'pageswithprop-legend' );
117 $form->addHeaderText( $this->
msg(
'pageswithprop-text' )->parseAsBlock() );
118 $form->setSubmitTextMsg(
'pageswithprop-submit' );
120 $form->prepareForm();
121 $form->displayForm(
false );
122 if ( $propname !==
'' && $propname !==
null ) {
128 $this->propName = $data[
'propname'];
129 parent::execute( $data[
'propname'] );
156 'tables' => [
'page_props',
'page' ],
158 'page_id' =>
'pp_page',
170 'page' => [
'JOIN',
'page_id = pp_page' ]
175 if ( $this->ns !==
null ) {
176 $query[
'conds'][
'page_namespace'] =
$this->ns;
183 $sort = [
'page_id' ];
184 if ( $this->sortByValue ) {
185 array_unshift( $sort,
'pp_sortkey' );
203 $title = Title::newFromRow( $result );
205 if ( $result->pp_value !==
'' ) {
207 $valueLength = strlen( $result->pp_value );
208 $isBinary = strpos( $result->pp_value,
"\0" ) !==
false;
209 $isTooLong = $valueLength > 1024;
211 if ( $isBinary || $isTooLong ) {
213 ->msg( $isBinary ?
'pageswithprop-prophidden-binary' :
'pageswithprop-prophidden-long' )
214 ->params( $this->
getLanguage()->formatSize( $valueLength ) );
216 $propValue = Html::element(
'span', [
'class' =>
'prop-value-hidden' ], $message->text() );
218 $propValue = Html::element(
'span', [
'class' =>
'prop-value' ], $result->pp_value );
221 $ret .= $this->
msg(
'colon-separator' )->escaped() . $propValue;
228 if ( $this->existingPropNames ===
null ) {
236 'DISTINCT',
'ORDER BY' =>
'pp_propname'
254 foreach (
$res as $row ) {
255 $propnames[$row->pp_propname] = $row->pp_propname;
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
An IContextSource implementation which will inherit context from another source but allow individual ...
This is a class for doing query pages; since they're almost all the same, we factor out some of the f...
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.
getLanguage()
Shortcut to get user's language.
Special:PagesWithProp to search the page_props table.
execute( $par)
This is the actual workhorse.
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...
string[] null $existingPropNames
getOrderFields()
Subclasses return an array of fields to order by here.
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...
__construct( $name='PagesWithProp')
formatResult( $skin, $result)