MediaWiki master
SpecialUnusedCategories.php
Go to the documentation of this file.
1<?php
21namespace MediaWiki\Specials;
22
26use Skin;
27use stdClass;
29
36
41 public function __construct(
42 IConnectionProvider $dbProvider,
43 LinkBatchFactory $linkBatchFactory
44 ) {
45 parent::__construct( 'Unusedcategories' );
46 $this->setDatabaseProvider( $dbProvider );
47 $this->setLinkBatchFactory( $linkBatchFactory );
48 }
49
50 public function isExpensive() {
51 return true;
52 }
53
54 protected function getPageHeader() {
55 return $this->msg( 'unusedcategoriestext' )->parseAsBlock();
56 }
57
58 protected function getOrderFields() {
59 return [ 'title' ];
60 }
61
62 public function getQueryInfo() {
63 return [
64 'tables' => [ 'page', 'categorylinks', 'page_props' ],
65 'fields' => [
66 'namespace' => 'page_namespace',
67 'title' => 'page_title',
68 ],
69 'conds' => [
70 'cl_from' => null,
71 'page_namespace' => NS_CATEGORY,
72 'page_is_redirect' => 0,
73 'pp_page' => null,
74 ],
75 'join_conds' => [
76 'categorylinks' => [ 'LEFT JOIN', 'cl_to = page_title' ],
77 'page_props' => [ 'LEFT JOIN', [
78 'page_id = pp_page',
79 'pp_propname' => 'expectunusedcategory'
80 ] ]
81 ]
82 ];
83 }
84
89 protected function sortDescending() {
90 return false;
91 }
92
98 public function formatResult( $skin, $result ) {
99 $title = Title::makeTitle( NS_CATEGORY, $result->title );
100
101 return $this->getLinkRenderer()->makeLink( $title, $title->getText() );
102 }
103
104 protected function getGroupName() {
105 return 'maintenance';
106 }
107
108 public function preprocessResults( $db, $res ) {
109 $this->executeLBFromResultWrapper( $res );
110 }
111}
112
117class_alias( SpecialUnusedCategories::class, 'SpecialUnusedCategories' );
const NS_CATEGORY
Definition Defines.php:79
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:89
setDatabaseProvider(IConnectionProvider $databaseProvider)
executeLBFromResultWrapper(IResultWrapper $res, $ns=null)
Creates a new LinkBatch object, adds all pages from the passed result wrapper (MUST include title and...
setLinkBatchFactory(LinkBatchFactory $linkBatchFactory)
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
getQueryInfo()
Subclasses return an SQL query here, formatted as an array with the following keys: tables => Table(s...
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
isExpensive()
Should this query page only be updated offline on large wikis?
sortDescending()
A should come before Z (T32907)
getPageHeader()
The content returned by this function will be output before any result.
preprocessResults( $db, $res)
Do any necessary preprocessing of the result object.
__construct(IConnectionProvider $dbProvider, LinkBatchFactory $linkBatchFactory)
getOrderFields()
Subclasses return an array of fields to order by here.
Represents a title within MediaWiki.
Definition Title.php:79
The base class for all skins.
Definition Skin.php:59
Provide primary and replica IDatabase connections.