MediaWiki master
SpecialUncategorizedPages.php
Go to the documentation of this file.
1<?php
21namespace MediaWiki\Specials;
22
28
38 protected $requestedNamespace = false;
39
40 private NamespaceInfo $namespaceInfo;
41
48 public function __construct(
49 NamespaceInfo $namespaceInfo,
50 IConnectionProvider $dbProvider,
51 LinkBatchFactory $linkBatchFactory,
52 LanguageConverterFactory $languageConverterFactory
53 ) {
54 parent::__construct( 'Uncategorizedpages' );
55 $this->namespaceInfo = $namespaceInfo;
56 $this->setDatabaseProvider( $dbProvider );
57 $this->setLinkBatchFactory( $linkBatchFactory );
58 $this->setLanguageConverter( $languageConverterFactory->getLanguageConverter( $this->getContentLanguage() ) );
59 }
60
61 protected function sortDescending() {
62 return false;
63 }
64
65 public function isExpensive() {
66 return true;
67 }
68
69 public function isSyndicated() {
70 return false;
71 }
72
73 public function execute( $par ) {
74 $this->addHelpLink( 'Help:Categories' );
75 parent::execute( $par );
76 }
77
78 public function getQueryInfo() {
79 return [
80 'tables' => [ 'page', 'categorylinks' ],
81 'fields' => [
82 'namespace' => 'page_namespace',
83 'title' => 'page_title',
84 ],
85 // default for page_namespace is all content namespaces (if requestedNamespace is false)
86 // otherwise, page_namespace is requestedNamespace
87 'conds' => [
88 'cl_from' => null,
89 'page_namespace' => $this->requestedNamespace !== false
90 ? $this->requestedNamespace
91 : $this->namespaceInfo->getContentNamespaces(),
92 'page_is_redirect' => 0
93 ],
94 'join_conds' => [
95 'categorylinks' => [ 'LEFT JOIN', 'cl_from = page_id' ]
96 ]
97 ];
98 }
99
100 protected function getOrderFields() {
101 // For some crazy reason ordering by a constant
102 // causes a filesort
103 if ( $this->requestedNamespace === false &&
104 count( $this->namespaceInfo->getContentNamespaces() ) > 1
105 ) {
106 return [ 'page_namespace', 'page_title' ];
107 }
108
109 return [ 'page_title' ];
110 }
111
112 protected function getGroupName() {
113 return 'maintenance';
114 }
115}
116
121class_alias( SpecialUncategorizedPages::class, 'SpecialUncategorizedPages' );
An interface for creating language converters.
getLanguageConverter( $language=null)
Provide a LanguageConverter for given language.
Variant of QueryPage which formats the result as a simple link to the page.
setLanguageConverter(ILanguageConverter $languageConverter)
setDatabaseProvider(IConnectionProvider $databaseProvider)
setLinkBatchFactory(LinkBatchFactory $linkBatchFactory)
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
getOrderFields()
Subclasses return an array of fields to order by here.
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
__construct(NamespaceInfo $namespaceInfo, IConnectionProvider $dbProvider, LinkBatchFactory $linkBatchFactory, LanguageConverterFactory $languageConverterFactory)
sortDescending()
Override to sort by increasing values.
getQueryInfo()
Subclasses return an SQL query here, formatted as an array with the following keys: tables => Table(s...
isSyndicated()
Sometimes we don't want to build rss / atom feeds.
isExpensive()
Should this query page only be updated offline on large wikis?
This is a utility class for dealing with namespaces that encodes all the "magic" behaviors of them ba...
Provide primary and replica IDatabase connections.