MediaWiki master
SpecialUncategorizedPages.php
Go to the documentation of this file.
1<?php
7namespace MediaWiki\Specials;
8
15
25 protected $requestedNamespace = false;
26
27 public function __construct(
28 private readonly NamespaceInfo $namespaceInfo,
29 IConnectionProvider $dbProvider,
30 LinkBatchFactory $linkBatchFactory,
31 LanguageConverterFactory $languageConverterFactory
32 ) {
33 parent::__construct( 'Uncategorizedpages' );
34 $this->setDatabaseProvider( $dbProvider );
35 $this->setLinkBatchFactory( $linkBatchFactory );
36 $this->setLanguageConverter( $languageConverterFactory->getLanguageConverter( $this->getContentLanguage() ) );
37 }
38
40 protected function sortDescending() {
41 return false;
42 }
43
45 public function isExpensive() {
46 return true;
47 }
48
50 public function isSyndicated() {
51 return false;
52 }
53
55 public function execute( $par ) {
56 $this->addHelpLink( 'Help:Categories' );
57 parent::execute( $par );
58 }
59
61 public function getQueryInfo() {
62 return [
63 'tables' => [ 'page', 'categorylinks' ],
64 'fields' => [
65 'namespace' => 'page_namespace',
66 'title' => 'page_title',
67 ],
68 // default for page_namespace is all content namespaces (if requestedNamespace is false)
69 // otherwise, page_namespace is requestedNamespace
70 'conds' => [
71 'cl_from' => null,
72 'page_namespace' => $this->requestedNamespace !== false
73 ? $this->requestedNamespace
74 : $this->namespaceInfo->getContentNamespaces(),
75 'page_is_redirect' => 0
76 ],
77 'join_conds' => [
78 'categorylinks' => [ 'LEFT JOIN', 'cl_from = page_id' ]
79 ]
80 ];
81 }
82
84 protected function getRecacheDB() {
85 return $this->getDatabaseProvider()->getReplicaDatabase(
86 CategoryLinksTable::VIRTUAL_DOMAIN,
87 'vslow'
88 );
89 }
90
92 protected function getOrderFields() {
93 // For some crazy reason ordering by a constant
94 // causes a filesort
95 if ( $this->requestedNamespace === false &&
96 count( $this->namespaceInfo->getContentNamespaces() ) > 1
97 ) {
98 return [ 'page_namespace', 'page_title' ];
99 }
100
101 return [ 'page_title' ];
102 }
103
105 protected function getGroupName() {
106 return 'maintenance';
107 }
108}
109
114class_alias( SpecialUncategorizedPages::class, 'SpecialUncategorizedPages' );
An interface for creating language converters.
getLanguageConverter( $language=null)
Provide a LanguageConverter for given language.
Factory for LinkBatch objects to batch query page metadata.
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.Don't append DESC to the field names,...
execute( $par)
This is the actual workhorse.It does everything needed to make a real, honest-to-gosh query page....
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
sortDescending()
Override to sort by increasing values.to override bool
getRecacheDB()
Get a DB connection to be used for slow recache queries.to override IReadableDatabase
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.to override bool
__construct(private readonly NamespaceInfo $namespaceInfo, IConnectionProvider $dbProvider, LinkBatchFactory $linkBatchFactory, LanguageConverterFactory $languageConverterFactory)
isExpensive()
Should this query page only be updated offline on large wikis?If the query for this page is considere...
This is a utility class for dealing with namespaces that encodes all the "magic" behaviors of them ba...
Provide primary and replica IDatabase connections.