MediaWiki master
SpecialDeadendPages.php
Go to the documentation of this file.
1<?php
21namespace MediaWiki\Specials;
22
28
35
36 private NamespaceInfo $namespaceInfo;
37
44 public function __construct(
45 NamespaceInfo $namespaceInfo,
46 IConnectionProvider $dbProvider,
47 LinkBatchFactory $linkBatchFactory,
48 LanguageConverterFactory $languageConverterFactory
49 ) {
50 parent::__construct( 'Deadendpages' );
51 $this->namespaceInfo = $namespaceInfo;
52 $this->setDatabaseProvider( $dbProvider );
53 $this->setLinkBatchFactory( $linkBatchFactory );
54 $this->setLanguageConverter( $languageConverterFactory->getLanguageConverter( $this->getContentLanguage() ) );
55 }
56
57 protected function getPageHeader() {
58 return $this->msg( 'deadendpagestext' )->parseAsBlock();
59 }
60
66 public function isExpensive() {
67 return true;
68 }
69
70 public function isSyndicated() {
71 return false;
72 }
73
77 protected function sortDescending() {
78 return false;
79 }
80
81 public function getQueryInfo() {
82 return [
83 'tables' => [ 'page', 'pagelinks' ],
84 'fields' => [
85 'namespace' => 'page_namespace',
86 'title' => 'page_title',
87 ],
88 'conds' => [
89 'pl_from' => null,
90 'page_namespace' => $this->namespaceInfo->getContentNamespaces(),
91 'page_is_redirect' => 0
92 ],
93 'join_conds' => [
94 'pagelinks' => [
95 'LEFT JOIN',
96 [ 'page_id=pl_from' ]
97 ]
98 ]
99 ];
100 }
101
102 protected function getOrderFields() {
103 // For some crazy reason ordering by a constant
104 // causes a filesort
105 if ( count( $this->namespaceInfo->getContentNamespaces() ) > 1 ) {
106 return [ 'page_namespace', 'page_title' ];
107 } else {
108 return [ 'page_title' ];
109 }
110 }
111
112 protected function getGroupName() {
113 return 'maintenance';
114 }
115}
116
118class_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.