MediaWiki master
SpecialDeadendPages.php
Go to the documentation of this file.
1<?php
7namespace MediaWiki\Specials;
8
15
22
23 public function __construct(
24 private readonly NamespaceInfo $namespaceInfo,
25 IConnectionProvider $dbProvider,
26 LinkBatchFactory $linkBatchFactory,
27 LanguageConverterFactory $languageConverterFactory
28 ) {
29 parent::__construct( 'Deadendpages' );
30 $this->setDatabaseProvider( $dbProvider );
31 $this->setLinkBatchFactory( $linkBatchFactory );
32 $this->setLanguageConverter( $languageConverterFactory->getLanguageConverter( $this->getContentLanguage() ) );
33 }
34
36 protected function getPageHeader() {
37 return $this->msg( 'deadendpagestext' )->parseAsBlock();
38 }
39
45 public function isExpensive() {
46 return true;
47 }
48
50 public function isSyndicated() {
51 return false;
52 }
53
57 protected function sortDescending() {
58 return false;
59 }
60
62 public function getQueryInfo() {
63 return [
64 'tables' => [ 'page', 'pagelinks' ],
65 'fields' => [
66 'namespace' => 'page_namespace',
67 'title' => 'page_title',
68 ],
69 'conds' => [
70 'pl_from' => null,
71 'page_namespace' => $this->namespaceInfo->getContentNamespaces(),
72 'page_is_redirect' => 0
73 ],
74 'join_conds' => [
75 'pagelinks' => [
76 'LEFT JOIN',
77 [ 'page_id=pl_from' ]
78 ]
79 ]
80 ];
81 }
82
84 protected function getRecacheDB() {
85 return $this->getDatabaseProvider()->getReplicaDatabase(
86 PageLinksTable::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 ( count( $this->namespaceInfo->getContentNamespaces() ) > 1 ) {
96 return [ 'page_namespace', 'page_title' ];
97 } else {
98 return [ 'page_title' ];
99 }
100 }
101
103 protected function getGroupName() {
104 return 'maintenance';
105 }
106}
107
109class_alias( SpecialDeadendPages::class, 'SpecialDeadendPages' );
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)
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
__construct(private readonly NamespaceInfo $namespaceInfo, IConnectionProvider $dbProvider, LinkBatchFactory $linkBatchFactory, LanguageConverterFactory $languageConverterFactory)
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,...
This is a utility class for dealing with namespaces that encodes all the "magic" behaviors of them ba...
Provide primary and replica IDatabase connections.