MediaWiki master
SpecialUnusedCategories.php
Go to the documentation of this file.
1<?php
21namespace MediaWiki\Specials;
22
26use Skin;
27use stdClass;
29
36
37 public function __construct(
38 IConnectionProvider $dbProvider,
39 LinkBatchFactory $linkBatchFactory
40 ) {
41 parent::__construct( 'Unusedcategories' );
42 $this->setDatabaseProvider( $dbProvider );
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' => null,
67 'page_namespace' => NS_CATEGORY,
68 'page_is_redirect' => 0,
69 'pp_page' => 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 ) {
105 $this->executeLBFromResultWrapper( $res );
106 }
107}
108
113class_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:87
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:78
The base class for all skins.
Definition Skin.php:64
Provide primary and replica IDatabase connections.