MediaWiki master
SpecialUncategorizedPages.php
Go to the documentation of this file.
1<?php
24namespace MediaWiki\Specials;
25
31
40 protected $requestedNamespace = false;
41
42 private NamespaceInfo $namespaceInfo;
43
50 public function __construct(
51 NamespaceInfo $namespaceInfo,
52 IConnectionProvider $dbProvider,
53 LinkBatchFactory $linkBatchFactory,
54 LanguageConverterFactory $languageConverterFactory
55 ) {
56 parent::__construct( 'Uncategorizedpages' );
57 $this->namespaceInfo = $namespaceInfo;
58 $this->setDatabaseProvider( $dbProvider );
59 $this->setLinkBatchFactory( $linkBatchFactory );
60 $this->setLanguageConverter( $languageConverterFactory->getLanguageConverter( $this->getContentLanguage() ) );
61 }
62
63 protected function sortDescending() {
64 return false;
65 }
66
67 public function isExpensive() {
68 return true;
69 }
70
71 public function isSyndicated() {
72 return false;
73 }
74
75 public function execute( $par ) {
76 $this->addHelpLink( 'Help:Categories' );
77 parent::execute( $par );
78 }
79
80 public function getQueryInfo() {
81 return [
82 'tables' => [ 'page', 'categorylinks' ],
83 'fields' => [
84 'namespace' => 'page_namespace',
85 'title' => 'page_title',
86 ],
87 // default for page_namespace is all content namespaces (if requestedNamespace is false)
88 // otherwise, page_namespace is requestedNamespace
89 'conds' => [
90 'cl_from' => null,
91 'page_namespace' => $this->requestedNamespace !== false
92 ? $this->requestedNamespace
93 : $this->namespaceInfo->getContentNamespaces(),
94 'page_is_redirect' => 0
95 ],
96 'join_conds' => [
97 'categorylinks' => [ 'LEFT JOIN', 'cl_from = page_id' ]
98 ]
99 ];
100 }
101
102 protected function getOrderFields() {
103 // For some crazy reason ordering by a constant
104 // causes a filesort
105 if ( $this->requestedNamespace === false &&
106 count( $this->namespaceInfo->getContentNamespaces() ) > 1
107 ) {
108 return [ 'page_namespace', 'page_title' ];
109 }
110
111 return [ 'page_title' ];
112 }
113
114 protected function getGroupName() {
115 return 'maintenance';
116 }
117}
118
123class_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.
A special page looking for page without any category.
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.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU Ge...