MediaWiki REL1_40
SpecialUnusedCategories.php
Go to the documentation of this file.
1<?php
27
32
37 public function __construct(
38 ILoadBalancer $loadBalancer,
39 LinkBatchFactory $linkBatchFactory
40 ) {
41 parent::__construct( 'Unusedcategories' );
42 $this->setDBLoadBalancer( $loadBalancer );
43 $this->setLinkBatchFactory( $linkBatchFactory );
44 }
45
46 public function isExpensive() {
47 return true;
48 }
49
50 protected function getPageHeader() {
51 return $this->msg( 'unusedcategoriestext' )->parseAsBlock();
52 }
53
54 protected function getOrderFields() {
55 return [ 'title' ];
56 }
57
58 public function getQueryInfo() {
59 return [
60 'tables' => [ 'page', 'categorylinks', 'page_props' ],
61 'fields' => [
62 'namespace' => 'page_namespace',
63 'title' => 'page_title',
64 ],
65 'conds' => [
66 'cl_from IS NULL',
67 'page_namespace' => NS_CATEGORY,
68 'page_is_redirect' => 0,
69 'pp_page IS NULL'
70 ],
71 'join_conds' => [
72 'categorylinks' => [ 'LEFT JOIN', 'cl_to = page_title' ],
73 'page_props' => [ 'LEFT JOIN', [
74 'page_id = pp_page',
75 'pp_propname' => 'expectunusedcategory'
76 ] ]
77 ]
78 ];
79 }
80
85 protected function sortDescending() {
86 return false;
87 }
88
94 public function formatResult( $skin, $result ) {
95 $title = Title::makeTitle( NS_CATEGORY, $result->title );
96
97 return $this->getLinkRenderer()->makeLink( $title, $title->getText() );
98 }
99
100 protected function getGroupName() {
101 return 'maintenance';
102 }
103
104 public function preprocessResults( $db, $res ) {
106 }
107}
const NS_CATEGORY
Definition Defines.php:78
Represents a title within MediaWiki.
Definition Title.php:82
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:45
executeLBFromResultWrapper(IResultWrapper $res, $ns=null)
Creates a new LinkBatch object, adds all pages from the passed result wrapper (MUST include title and...
setDBLoadBalancer(ILoadBalancer $loadBalancer)
setLinkBatchFactory(LinkBatchFactory $linkBatchFactory)
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
getOrderFields()
Subclasses return an array of fields to order by here.
isExpensive()
Should this query page only be updated offline on large wikis?
sortDescending()
A should come before Z (T32907)
preprocessResults( $db, $res)
Do any necessary preprocessing of the result object.
getQueryInfo()
Subclasses return an SQL query here, formatted as an array with the following keys: tables => Table(s...
__construct(ILoadBalancer $loadBalancer, LinkBatchFactory $linkBatchFactory)
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
getPageHeader()
The content returned by this function will be output before any result.
This class is a delegate to ILBFactory for a given database cluster.