MediaWiki  master
SpecialUnusedCategories.php
Go to the documentation of this file.
1 <?php
26 
31 
36  public function __construct(
39  ) {
40  parent::__construct( 'Unusedcategories' );
41  $this->setDBLoadBalancer( $loadBalancer );
42  $this->setLinkBatchFactory( $linkBatchFactory );
43  }
44 
45  public function isExpensive() {
46  return true;
47  }
48 
49  protected function getPageHeader() {
50  return $this->msg( 'unusedcategoriestext' )->parseAsBlock();
51  }
52 
53  protected function getOrderFields() {
54  return [ 'title' ];
55  }
56 
57  public function getQueryInfo() {
58  return [
59  'tables' => [ 'page', 'categorylinks', 'page_props' ],
60  'fields' => [
61  'namespace' => 'page_namespace',
62  'title' => 'page_title',
63  ],
64  'conds' => [
65  'cl_from IS NULL',
66  'page_namespace' => NS_CATEGORY,
67  'page_is_redirect' => 0,
68  'pp_page IS NULL'
69  ],
70  'join_conds' => [
71  'categorylinks' => [ 'LEFT JOIN', 'cl_to = page_title' ],
72  'page_props' => [ 'LEFT JOIN', [
73  'page_id = pp_page',
74  'pp_propname' => 'expectunusedcategory'
75  ] ]
76  ]
77  ];
78  }
79 
84  protected function sortDescending() {
85  return false;
86  }
87 
93  public function formatResult( $skin, $result ) {
94  $title = Title::makeTitle( NS_CATEGORY, $result->title );
95 
96  return $this->getLinkRenderer()->makeLink( $title, $title->getText() );
97  }
98 
99  protected function getGroupName() {
100  return 'maintenance';
101  }
102 
103  public function preprocessResults( $db, $res ) {
105  }
106 }
SpecialPage\msg
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
Definition: SpecialPage.php:912
SpecialUnusedCategories\preprocessResults
preprocessResults( $db, $res)
Do any necessary preprocessing of the result object.
Definition: SpecialUnusedCategories.php:103
$res
$res
Definition: testCompression.php:57
QueryPage
This is a class for doing query pages; since they're almost all the same, we factor out some of the f...
Definition: QueryPage.php:41
QueryPage\executeLBFromResultWrapper
executeLBFromResultWrapper(IResultWrapper $res, $ns=null)
Creates a new LinkBatch object, adds all pages from the passed result wrapper (MUST include title and...
Definition: QueryPage.php:874
SpecialUnusedCategories\sortDescending
sortDescending()
A should come before Z (T32907)
Definition: SpecialUnusedCategories.php:84
QueryPage\setLinkBatchFactory
setLinkBatchFactory(LinkBatchFactory $linkBatchFactory)
Definition: QueryPage.php:135
SpecialUnusedCategories
Definition: SpecialUnusedCategories.php:30
MediaWiki\Cache\LinkBatchFactory
Definition: LinkBatchFactory.php:39
SpecialUnusedCategories\getPageHeader
getPageHeader()
The content returned by this function will be output before any result.
Definition: SpecialUnusedCategories.php:49
SpecialUnusedCategories\isExpensive
isExpensive()
Is this query expensive (for some definition of expensive)? Then we don't let it run in miser mode.
Definition: SpecialUnusedCategories.php:45
$title
$title
Definition: testCompression.php:38
Title\makeTitle
static makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:663
QueryPage\setDBLoadBalancer
setDBLoadBalancer(ILoadBalancer $loadBalancer)
Definition: QueryPage.php:892
QueryPage\$linkBatchFactory
LinkBatchFactory null $linkBatchFactory
Definition: QueryPage.php:74
SpecialUnusedCategories\getGroupName
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
Definition: SpecialUnusedCategories.php:99
SpecialPage\getLinkRenderer
getLinkRenderer()
Definition: SpecialPage.php:1028
SpecialUnusedCategories\__construct
__construct(ILoadBalancer $loadBalancer, LinkBatchFactory $linkBatchFactory)
Definition: SpecialUnusedCategories.php:36
SpecialUnusedCategories\formatResult
formatResult( $skin, $result)
Definition: SpecialUnusedCategories.php:93
NS_CATEGORY
const NS_CATEGORY
Definition: Defines.php:78
QueryPage\$loadBalancer
ILoadBalancer null $loadBalancer
Definition: QueryPage.php:71
SpecialUnusedCategories\getQueryInfo
getQueryInfo()
Subclasses return an SQL query here, formatted as an array with the following keys: tables => Table(s...
Definition: SpecialUnusedCategories.php:57
SpecialUnusedCategories\getOrderFields
getOrderFields()
Subclasses return an array of fields to order by here.
Definition: SpecialUnusedCategories.php:53
Wikimedia\Rdbms\ILoadBalancer
Database cluster connection, tracking, load balancing, and transaction manager interface.
Definition: ILoadBalancer.php:81