MediaWiki REL1_39
SpecialUnusedCategories.php
Go to the documentation of this file.
1<?php
26
31
36 public function __construct(
37 ILoadBalancer $loadBalancer,
38 LinkBatchFactory $linkBatchFactory
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}
const NS_CATEGORY
Definition Defines.php:78
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:42
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.
Create and track the database connections and transactions for a given database cluster.