MediaWiki master
SpecialDeadendPages.php
Go to the documentation of this file.
1<?php
24namespace MediaWiki\Specials;
25
31
38
39 private NamespaceInfo $namespaceInfo;
40
47 public function __construct(
48 NamespaceInfo $namespaceInfo,
49 IConnectionProvider $dbProvider,
50 LinkBatchFactory $linkBatchFactory,
51 LanguageConverterFactory $languageConverterFactory
52 ) {
53 parent::__construct( 'Deadendpages' );
54 $this->namespaceInfo = $namespaceInfo;
55 $this->setDatabaseProvider( $dbProvider );
56 $this->setLinkBatchFactory( $linkBatchFactory );
57 $this->setLanguageConverter( $languageConverterFactory->getLanguageConverter( $this->getContentLanguage() ) );
58 }
59
60 protected function getPageHeader() {
61 return $this->msg( 'deadendpagestext' )->parseAsBlock();
62 }
63
69 public function isExpensive() {
70 return true;
71 }
72
73 public function isSyndicated() {
74 return false;
75 }
76
80 protected function sortDescending() {
81 return false;
82 }
83
84 public function getQueryInfo() {
85 return [
86 'tables' => [ 'page', 'pagelinks' ],
87 'fields' => [
88 'namespace' => 'page_namespace',
89 'title' => 'page_title',
90 ],
91 'conds' => [
92 'pl_from' => null,
93 'page_namespace' => $this->namespaceInfo->getContentNamespaces(),
94 'page_is_redirect' => 0
95 ],
96 'join_conds' => [
97 'pagelinks' => [
98 'LEFT JOIN',
99 [ 'page_id=pl_from' ]
100 ]
101 ]
102 ];
103 }
104
105 protected function getOrderFields() {
106 // For some crazy reason ordering by a constant
107 // causes a filesort
108 if ( count( $this->namespaceInfo->getContentNamespaces() ) > 1 ) {
109 return [ 'page_namespace', 'page_title' ];
110 } else {
111 return [ 'page_title' ];
112 }
113 }
114
115 protected function getGroupName() {
116 return 'maintenance';
117 }
118}
119
121class_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.
A special page that list pages that contain no link 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.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU Ge...