MediaWiki master
SpecialUnusedCategories.php
Go to the documentation of this file.
1<?php
24namespace MediaWiki\Specials;
25
29use Skin;
30use stdClass;
32
37
42 public function __construct(
43 IConnectionProvider $dbProvider,
44 LinkBatchFactory $linkBatchFactory
45 ) {
46 parent::__construct( 'Unusedcategories' );
47 $this->setDatabaseProvider( $dbProvider );
48 $this->setLinkBatchFactory( $linkBatchFactory );
49 }
50
51 public function isExpensive() {
52 return true;
53 }
54
55 protected function getPageHeader() {
56 return $this->msg( 'unusedcategoriestext' )->parseAsBlock();
57 }
58
59 protected function getOrderFields() {
60 return [ 'title' ];
61 }
62
63 public function getQueryInfo() {
64 return [
65 'tables' => [ 'page', 'categorylinks', 'page_props' ],
66 'fields' => [
67 'namespace' => 'page_namespace',
68 'title' => 'page_title',
69 ],
70 'conds' => [
71 'cl_from' => null,
72 'page_namespace' => NS_CATEGORY,
73 'page_is_redirect' => 0,
74 'pp_page' => null,
75 ],
76 'join_conds' => [
77 'categorylinks' => [ 'LEFT JOIN', 'cl_to = page_title' ],
78 'page_props' => [ 'LEFT JOIN', [
79 'page_id = pp_page',
80 'pp_propname' => 'expectunusedcategory'
81 ] ]
82 ]
83 ];
84 }
85
90 protected function sortDescending() {
91 return false;
92 }
93
99 public function formatResult( $skin, $result ) {
100 $title = Title::makeTitle( NS_CATEGORY, $result->title );
101
102 return $this->getLinkRenderer()->makeLink( $title, $title->getText() );
103 }
104
105 protected function getGroupName() {
106 return 'maintenance';
107 }
108
109 public function preprocessResults( $db, $res ) {
110 $this->executeLBFromResultWrapper( $res );
111 }
112}
113
118class_alias( SpecialUnusedCategories::class, 'SpecialUnusedCategories' );
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:88
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:58
Provide primary and replica IDatabase connections.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU Ge...