MediaWiki master
SpecialDeadendPages.php
Go to the documentation of this file.
1<?php
21namespace MediaWiki\Specials;
22
28
35
36 private NamespaceInfo $namespaceInfo;
37
38 public function __construct(
39 NamespaceInfo $namespaceInfo,
40 IConnectionProvider $dbProvider,
41 LinkBatchFactory $linkBatchFactory,
42 LanguageConverterFactory $languageConverterFactory
43 ) {
44 parent::__construct( 'Deadendpages' );
45 $this->namespaceInfo = $namespaceInfo;
46 $this->setDatabaseProvider( $dbProvider );
47 $this->setLinkBatchFactory( $linkBatchFactory );
48 $this->setLanguageConverter( $languageConverterFactory->getLanguageConverter( $this->getContentLanguage() ) );
49 }
50
51 protected function getPageHeader() {
52 return $this->msg( 'deadendpagestext' )->parseAsBlock();
53 }
54
60 public function isExpensive() {
61 return true;
62 }
63
64 public function isSyndicated() {
65 return false;
66 }
67
71 protected function sortDescending() {
72 return false;
73 }
74
75 public function getQueryInfo() {
76 return [
77 'tables' => [ 'page', 'pagelinks' ],
78 'fields' => [
79 'namespace' => 'page_namespace',
80 'title' => 'page_title',
81 ],
82 'conds' => [
83 'pl_from' => null,
84 'page_namespace' => $this->namespaceInfo->getContentNamespaces(),
85 'page_is_redirect' => 0
86 ],
87 'join_conds' => [
88 'pagelinks' => [
89 'LEFT JOIN',
90 [ 'page_id=pl_from' ]
91 ]
92 ]
93 ];
94 }
95
96 protected function getOrderFields() {
97 // For some crazy reason ordering by a constant
98 // causes a filesort
99 if ( count( $this->namespaceInfo->getContentNamespaces() ) > 1 ) {
100 return [ 'page_namespace', 'page_title' ];
101 } else {
102 return [ 'page_title' ];
103 }
104 }
105
106 protected function getGroupName() {
107 return 'maintenance';
108 }
109}
110
112class_alias( SpecialDeadendPages::class, 'SpecialDeadendPages' );
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)
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
List of pages that contain no links to other pages.
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.
getPageHeader()
The content returned by this function will be output before any result.
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.
__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.