MediaWiki master
SpecialDeadendPages.php
Go to the documentation of this file.
1<?php
7namespace MediaWiki\Specials;
8
9use MediaWiki\Cache\LinkBatchFactory;
11use MediaWiki\Languages\LanguageConverterFactory;
15
22
23 private NamespaceInfo $namespaceInfo;
24
25 public function __construct(
26 NamespaceInfo $namespaceInfo,
27 IConnectionProvider $dbProvider,
28 LinkBatchFactory $linkBatchFactory,
29 LanguageConverterFactory $languageConverterFactory
30 ) {
31 parent::__construct( 'Deadendpages' );
32 $this->namespaceInfo = $namespaceInfo;
33 $this->setDatabaseProvider( $dbProvider );
34 $this->setLinkBatchFactory( $linkBatchFactory );
35 $this->setLanguageConverter( $languageConverterFactory->getLanguageConverter( $this->getContentLanguage() ) );
36 }
37
39 protected function getPageHeader() {
40 return $this->msg( 'deadendpagestext' )->parseAsBlock();
41 }
42
48 public function isExpensive() {
49 return true;
50 }
51
53 public function isSyndicated() {
54 return false;
55 }
56
60 protected function sortDescending() {
61 return false;
62 }
63
65 public function getQueryInfo() {
66 return [
67 'tables' => [ 'page', 'pagelinks' ],
68 'fields' => [
69 'namespace' => 'page_namespace',
70 'title' => 'page_title',
71 ],
72 'conds' => [
73 'pl_from' => null,
74 'page_namespace' => $this->namespaceInfo->getContentNamespaces(),
75 'page_is_redirect' => 0
76 ],
77 'join_conds' => [
78 'pagelinks' => [
79 'LEFT JOIN',
80 [ 'page_id=pl_from' ]
81 ]
82 ]
83 ];
84 }
85
87 protected function getRecacheDB() {
88 return $this->getDatabaseProvider()->getReplicaDatabase(
89 PageLinksTable::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 ( count( $this->namespaceInfo->getContentNamespaces() ) > 1 ) {
99 return [ 'page_namespace', 'page_title' ];
100 } else {
101 return [ 'page_title' ];
102 }
103 }
104
106 protected function getGroupName() {
107 return 'maintenance';
108 }
109}
110
112class_alias( SpecialDeadendPages::class, 'SpecialDeadendPages' );
Variant of QueryPage which formats the result as a simple link to the page.
setLanguageConverter(ILanguageConverter $languageConverter)
setDatabaseProvider(IConnectionProvider $databaseProvider)
setLinkBatchFactory(LinkBatchFactory $linkBatchFactory)
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
List of pages that contain no links to other pages.
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
getPageHeader()
The content returned by this function will be output before any result.to override string
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
getOrderFields()
Subclasses return an array of fields to order by here.Don't append DESC to the field names,...
__construct(NamespaceInfo $namespaceInfo, IConnectionProvider $dbProvider, LinkBatchFactory $linkBatchFactory, LanguageConverterFactory $languageConverterFactory)
This is a utility class for dealing with namespaces that encodes all the "magic" behaviors of them ba...
Provide primary and replica IDatabase connections.