MediaWiki REL1_39
SpecialDeadendPages.php
Go to the documentation of this file.
1<?php
27
34
36 private $namespaceInfo;
37
44 public function __construct(
45 NamespaceInfo $namespaceInfo,
46 ILoadBalancer $loadBalancer,
47 LinkBatchFactory $linkBatchFactory,
48 LanguageConverterFactory $languageConverterFactory
49 ) {
50 parent::__construct( 'Deadendpages' );
51 $this->namespaceInfo = $namespaceInfo;
52 $this->setDBLoadBalancer( $loadBalancer );
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 IS 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}
An interface for creating language converters.
getLanguageConverter( $language=null)
Provide a LanguageConverter for given language.
This is a utility class for dealing with namespaces that encodes all the "magic" behaviors of them ba...
Variant of QueryPage which formats the result as a simple link to the page.
setLanguageConverter(ILanguageConverter $languageConverter)
setDBLoadBalancer(ILoadBalancer $loadBalancer)
setLinkBatchFactory(LinkBatchFactory $linkBatchFactory)
A special page that list pages that contain no link to other pages.
getOrderFields()
Subclasses return an array of fields to order by here.
isExpensive()
LEFT JOIN is expensive.
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
getQueryInfo()
Subclasses return an SQL query here, formatted as an array with the following keys: tables => Table(s...
getPageHeader()
The content returned by this function will be output before any result.
__construct(NamespaceInfo $namespaceInfo, ILoadBalancer $loadBalancer, LinkBatchFactory $linkBatchFactory, LanguageConverterFactory $languageConverterFactory)
isSyndicated()
Sometimes we don't want to build rss / atom feeds.
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
Create and track the database connections and transactions for a given database cluster.