MediaWiki REL1_31
SpecialWantedpages.php
Go to the documentation of this file.
1<?php
30
31 function __construct( $name = 'Wantedpages' ) {
32 parent::__construct( $name );
33 }
34
35 function isIncludable() {
36 return true;
37 }
38
39 function execute( $par ) {
40 $inc = $this->including();
41
42 if ( $inc ) {
43 $this->limit = (int)$par;
44 $this->offset = 0;
45 }
46 $this->setListoutput( $inc );
47 $this->shownavigation = !$inc;
48 parent::execute( $par );
49 }
50
51 function getQueryInfo() {
53 $count = $this->getConfig()->get( 'WantedPagesThreshold' ) - 1;
54 $query = [
55 'tables' => [
56 'pagelinks',
57 'pg1' => 'page',
58 'pg2' => 'page'
59 ],
60 'fields' => [
61 'namespace' => 'pl_namespace',
62 'title' => 'pl_title',
63 'value' => 'COUNT(*)'
64 ],
65 'conds' => [
66 'pg1.page_namespace IS NULL',
67 'pl_namespace NOT IN (' . $dbr->makeList( [ NS_USER, NS_USER_TALK ] ) . ')',
68 'pg2.page_namespace != ' . $dbr->addQuotes( NS_MEDIAWIKI ),
69 ],
70 'options' => [
71 'HAVING' => [
72 'COUNT(*) > ' . $dbr->addQuotes( $count ),
73 'COUNT(*) > SUM(pg2.page_is_redirect)'
74 ],
75 'GROUP BY' => [ 'pl_namespace', 'pl_title' ]
76 ],
77 'join_conds' => [
78 'pg1' => [
79 'LEFT JOIN', [
80 'pg1.page_namespace = pl_namespace',
81 'pg1.page_title = pl_title'
82 ]
83 ],
84 'pg2' => [ 'LEFT JOIN', 'pg2.page_id = pl_from' ]
85 ]
86 ];
87 // Replacement for the WantedPages::getSQL hook
88 // Avoid PHP 7.1 warning from passing $this by reference
89 $wantedPages = $this;
90 Hooks::run( 'WantedPages::getQueryInfo', [ &$wantedPages, &$query ] );
91
92 return $query;
93 }
94
95 protected function getGroupName() {
96 return 'maintenance';
97 }
98}
within a display generated by the Derivative if and wherever such third party notices normally appear The contents of the NOTICE file are for informational purposes only and do not modify the License You may add Your own attribution notices within Derivative Works that You alongside or as an addendum to the NOTICE text from the provided that such additional attribution notices cannot be construed as modifying the License You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for or distribution of Your or for any such Derivative Works as a provided Your and distribution of the Work otherwise complies with the conditions stated in this License Submission of Contributions Unless You explicitly state any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this without any additional terms or conditions Notwithstanding the nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions Trademarks This License does not grant permission to use the trade service or product names of the except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file Disclaimer of Warranty Unless required by applicable law or agreed to in Licensor provides the WITHOUT WARRANTIES OR CONDITIONS OF ANY either express or including
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
setListoutput( $bool)
A mutator for $this->listoutput;.
getConfig()
Shortcut to get main config object.
A special page that lists most linked pages that does not exist.
isIncludable()
Whether it's allowed to transclude the special page via {{Special:Foo/params}}.
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
execute( $par)
This is the actual workhorse.
__construct( $name='Wantedpages')
getQueryInfo()
Subclasses return an SQL query here, formatted as an array with the following keys: tables => Table(s...
Class definition for a wanted query page like WantedPages, WantedTemplates, etc.
null for the local wiki Added should default to null in handler for backwards compatibility add a value to it if you want to add a cookie that have to vary cache options can modify $query
Definition hooks.txt:1620
const NS_USER_TALK
Definition Defines.php:77
const DB_REPLICA
Definition defines.php:25