42 private $propName =
null;
47 private $existingPropNames =
null;
57 private $reverse =
false;
62 private $sortByValue =
false;
68 parent::__construct(
'PagesWithProp' );
79 $this->
getOutput()->addModuleStyles(
'mediawiki.special' );
82 $propname = $request->getVal(
'propname', $par );
83 $this->ns = $request->getIntOrNull(
'namespace' );
84 $this->reverse = $request->getBool(
'reverse' );
85 $this->sortByValue = $request->getBool(
'sortbyvalue' );
93 'options' => $propnames,
94 'default' => $propname,
95 'label-message' =>
'pageswithprop-prop',
99 'type' =>
'namespaceselect',
100 'name' =>
'namespace',
101 'label-message' =>
'namespace',
103 'default' => $this->ns,
108 'default' => $this->reverse,
109 'label-message' =>
'pageswithprop-reverse',
114 'name' =>
'sortbyvalue',
115 'default' => $this->sortByValue,
116 'label-message' =>
'pageswithprop-sortbyvalue',
121 $form = HTMLForm::factory(
'ooui', $fields, $this->
getContext() )
124 ->setSubmitCallback( [ $this,
'onSubmit' ] )
125 ->setWrapperLegendMsg(
'pageswithprop-legend' )
126 ->addHeaderHtml( $this->
msg(
'pageswithprop-text' )->parseAsBlock() )
127 ->setSubmitTextMsg(
'pageswithprop-submit' )
129 $form->displayForm(
false );
130 if ( $propname !==
'' && $propname !==
null ) {
136 $this->propName = $data[
'propname'];
137 parent::execute( $data[
'propname'] );
167 'reverse' => $this->reverse,
168 'sortbyvalue' => $this->sortByValue,
170 if ( $this->ns !==
null ) {
171 $params[
'namespace'] = $this->ns;
178 'tables' => [
'page_props',
'page' ],
180 'page_id' =>
'pp_page',
189 'pp_propname' => $this->propName,
192 'page' => [
'JOIN',
'page_id = pp_page' ]
197 if ( $this->ns !==
null ) {
198 $query[
'conds'][
'page_namespace'] = $this->ns;
205 $sort = [
'page_id' ];
206 if ( $this->sortByValue ) {
207 array_unshift( $sort,
'pp_sortkey' );
216 return !$this->reverse;
225 $title = Title::newFromRow( $result );
227 if ( $result->pp_value !==
'' ) {
229 $valueLength = strlen( $result->pp_value );
230 $isBinary = str_contains( $result->pp_value,
"\0" );
231 $isTooLong = $valueLength > 1024;
233 if ( $isBinary || $isTooLong ) {
235 ->msg( $isBinary ?
'pageswithprop-prophidden-binary' :
'pageswithprop-prophidden-long' )
236 ->sizeParams( $valueLength );
238 $propValue =
Html::element(
'span', [
'class' =>
'prop-value-hidden' ], $message->text() );
240 $propValue =
Html::element(
'span', [
'class' =>
'prop-value' ], $result->pp_value );
243 $ret .= $this->
msg(
'colon-separator' )->escaped() . $propValue;
250 if ( $this->existingPropNames ===
null ) {
253 return $this->existingPropNames;
258 ->getReplicaDatabase()
259 ->newSelectQueryBuilder()
260 ->select(
'pp_propname' )
262 ->from(
'page_props' )
263 ->orderBy(
'pp_propname' );
266 $queryBuilder->limit(
$limit );
269 $queryBuilder->offset(
$offset );
271 $res = $queryBuilder->caller( __METHOD__ )->fetchResultSet();
274 foreach ( $res as $row ) {
275 $propnames[$row->pp_propname] = $row->pp_propname;
290class_alias( SpecialPagesWithProp::class,
'SpecialPagesWithProp' );
array $params
The job parameters.
This is a class for doing query pages; since they're almost all the same, we factor out some of the f...
setDatabaseProvider(IConnectionProvider $databaseProvider)
int $offset
The offset and limit in use, as passed to the query() function.
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
static prefixSearchArray( $search, $limit, array $subpages, $offset)
Helper function for implementations of prefixSearchSubpages() that filter the values in memory (as op...
getPageTitle( $subpage=false)
Get a self-referential title object.
getContext()
Gets the context this SpecialPage is executed in.
getRequest()
Get the WebRequest being used for this instance.
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
getOutput()
Get the OutputPage being used for this instance.
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages By default the message key is the canonical name of...
Special:PagesWithProp to search the page_props table.
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
getQueryInfo()
Subclasses return an SQL query here, formatted as an array with the following keys: tables => Table(s...
__construct(IConnectionProvider $dbProvider)
getOrderFields()
Subclasses return an array of fields to order by here.
isCacheable()
Is the output of this query cacheable? Non-cacheable expensive pages will be disabled in miser mode a...
formatResult( $skin, $result)
isSyndicated()
Disable RSS/Atom feeds.
linkParameters()
If using extra form wheely-dealies, return a set of parameters here as an associative array....
prefixSearchSubpages( $search, $limit, $offset)
Return an array of subpages beginning with $search that this special page will accept.
execute( $par)
This is the actual workhorse.
queryExistingProps( $limit=null, $offset=0)
The base class for all skins.