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
42 public function __construct(
43 NamespaceInfo $namespaceInfo,
44 IConnectionProvider $dbProvider,
45 LinkBatchFactory $linkBatchFactory,
46 LanguageConverterFactory $languageConverterFactory
47 ) {
48 parent::__construct( 'Uncategorizedpages' );
49 $this->namespaceInfo = $namespaceInfo;
50 $this->setDatabaseProvider( $dbProvider );
51 $this->setLinkBatchFactory( $linkBatchFactory );
52 $this->setLanguageConverter( $languageConverterFactory->getLanguageConverter( $this->getContentLanguage() ) );
53 }
54
55 protected function sortDescending() {
56 return false;
57 }
58
59 public function isExpensive() {
60 return true;
61 }
62
63 public function isSyndicated() {
64 return false;
65 }
66
67 public function execute( $par ) {
68 $this->addHelpLink( 'Help:Categories' );
69 parent::execute( $par );
70 }
71
72 public function getQueryInfo() {
73 return [
74 'tables' => [ 'page', 'categorylinks' ],
75 'fields' => [
76 'namespace' => 'page_namespace',
77 'title' => 'page_title',
78 ],
79 // default for page_namespace is all content namespaces (if requestedNamespace is false)
80 // otherwise, page_namespace is requestedNamespace
81 'conds' => [
82 'cl_from' => null,
83 'page_namespace' => $this->requestedNamespace !== false
84 ? $this->requestedNamespace
85 : $this->namespaceInfo->getContentNamespaces(),
86 'page_is_redirect' => 0
87 ],
88 'join_conds' => [
89 'categorylinks' => [ 'LEFT JOIN', 'cl_from = page_id' ]
90 ]
91 ];
92 }
93
94 protected function getOrderFields() {
95 // For some crazy reason ordering by a constant
96 // causes a filesort
97 if ( $this->requestedNamespace === false &&
98 count( $this->namespaceInfo->getContentNamespaces() ) > 1
99 ) {
100 return [ 'page_namespace', 'page_title' ];
101 }
102
103 return [ 'page_title' ];
104 }
105
106 protected function getGroupName() {
107 return 'maintenance';
108 }
109}
110
115class_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.