MediaWiki master
SpecialUncategorizedPages.php
Go to the documentation of this file.
1<?php
7namespace MediaWiki\Specials;
8
9use MediaWiki\Cache\LinkBatchFactory;
11use MediaWiki\Languages\LanguageConverterFactory;
15
25 protected $requestedNamespace = false;
26
27 private NamespaceInfo $namespaceInfo;
28
29 public function __construct(
30 NamespaceInfo $namespaceInfo,
31 IConnectionProvider $dbProvider,
32 LinkBatchFactory $linkBatchFactory,
33 LanguageConverterFactory $languageConverterFactory
34 ) {
35 parent::__construct( 'Uncategorizedpages' );
36 $this->namespaceInfo = $namespaceInfo;
37 $this->setDatabaseProvider( $dbProvider );
38 $this->setLinkBatchFactory( $linkBatchFactory );
39 $this->setLanguageConverter( $languageConverterFactory->getLanguageConverter( $this->getContentLanguage() ) );
40 }
41
43 protected function sortDescending() {
44 return false;
45 }
46
48 public function isExpensive() {
49 return true;
50 }
51
53 public function isSyndicated() {
54 return false;
55 }
56
58 public function execute( $par ) {
59 $this->addHelpLink( 'Help:Categories' );
60 parent::execute( $par );
61 }
62
64 public function getQueryInfo() {
65 return [
66 'tables' => [ 'page', 'categorylinks' ],
67 'fields' => [
68 'namespace' => 'page_namespace',
69 'title' => 'page_title',
70 ],
71 // default for page_namespace is all content namespaces (if requestedNamespace is false)
72 // otherwise, page_namespace is requestedNamespace
73 'conds' => [
74 'cl_from' => null,
75 'page_namespace' => $this->requestedNamespace !== false
76 ? $this->requestedNamespace
77 : $this->namespaceInfo->getContentNamespaces(),
78 'page_is_redirect' => 0
79 ],
80 'join_conds' => [
81 'categorylinks' => [ 'LEFT JOIN', 'cl_from = page_id' ]
82 ]
83 ];
84 }
85
87 protected function getRecacheDB() {
88 return $this->getDatabaseProvider()->getReplicaDatabase(
89 CategoryLinksTable::VIRTUAL_DOMAIN,
90 'vslow'
91 );
92 }
93
95 protected function getOrderFields() {
96 // For some crazy reason ordering by a constant
97 // causes a filesort
98 if ( $this->requestedNamespace === false &&
99 count( $this->namespaceInfo->getContentNamespaces() ) > 1
100 ) {
101 return [ 'page_namespace', 'page_title' ];
102 }
103
104 return [ 'page_title' ];
105 }
106
108 protected function getGroupName() {
109 return 'maintenance';
110 }
111}
112
117class_alias( SpecialUncategorizedPages::class, 'SpecialUncategorizedPages' );
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...
__construct(NamespaceInfo $namespaceInfo, IConnectionProvider $dbProvider, LinkBatchFactory $linkBatchFactory, LanguageConverterFactory $languageConverterFactory)
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
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.