MediaWiki  master
SpecialDeadendPages.php
Go to the documentation of this file.
1 <?php
27 
34 
36  private $namespaceInfo;
37 
44  public function __construct(
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 }
SpecialDeadendPages\__construct
__construct(NamespaceInfo $namespaceInfo, ILoadBalancer $loadBalancer, LinkBatchFactory $linkBatchFactory, LanguageConverterFactory $languageConverterFactory)
Definition: SpecialDeadendPages.php:44
SpecialPage\msg
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
Definition: SpecialPage.php:912
SpecialDeadendPages\$namespaceInfo
NamespaceInfo $namespaceInfo
Definition: SpecialDeadendPages.php:36
MediaWiki\Languages\LanguageConverterFactory
An interface for creating language converters.
Definition: LanguageConverterFactory.php:46
PageQueryPage
Variant of QueryPage which formats the result as a simple link to the page.
Definition: PageQueryPage.php:34
QueryPage\setLinkBatchFactory
setLinkBatchFactory(LinkBatchFactory $linkBatchFactory)
Definition: QueryPage.php:135
SpecialDeadendPages\getGroupName
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
Definition: SpecialDeadendPages.php:112
MediaWiki\Languages\LanguageConverterFactory\getLanguageConverter
getLanguageConverter( $language=null)
Provide a LanguageConverter for given language.
Definition: LanguageConverterFactory.php:125
SpecialDeadendPages\getQueryInfo
getQueryInfo()
Subclasses return an SQL query here, formatted as an array with the following keys: tables => Table(s...
Definition: SpecialDeadendPages.php:81
MediaWiki\Cache\LinkBatchFactory
Definition: LinkBatchFactory.php:39
SpecialDeadendPages\sortDescending
sortDescending()
Definition: SpecialDeadendPages.php:77
SpecialDeadendPages
A special page that list pages that contain no link to other pages.
Definition: SpecialDeadendPages.php:33
PageQueryPage\setLanguageConverter
setLanguageConverter(ILanguageConverter $languageConverter)
Definition: PageQueryPage.php:57
SpecialDeadendPages\getPageHeader
getPageHeader()
The content returned by this function will be output before any result.
Definition: SpecialDeadendPages.php:57
QueryPage\setDBLoadBalancer
setDBLoadBalancer(ILoadBalancer $loadBalancer)
Definition: QueryPage.php:892
QueryPage\$linkBatchFactory
LinkBatchFactory null $linkBatchFactory
Definition: QueryPage.php:74
SpecialDeadendPages\isExpensive
isExpensive()
LEFT JOIN is expensive.
Definition: SpecialDeadendPages.php:66
QueryPage\$loadBalancer
ILoadBalancer null $loadBalancer
Definition: QueryPage.php:71
NamespaceInfo
This is a utility class for dealing with namespaces that encodes all the "magic" behaviors of them ba...
Definition: NamespaceInfo.php:35
SpecialDeadendPages\getOrderFields
getOrderFields()
Subclasses return an array of fields to order by here.
Definition: SpecialDeadendPages.php:102
SpecialDeadendPages\isSyndicated
isSyndicated()
Sometime we don't want to build rss / atom feeds.
Definition: SpecialDeadendPages.php:70
Wikimedia\Rdbms\ILoadBalancer
Database cluster connection, tracking, load balancing, and transaction manager interface.
Definition: ILoadBalancer.php:81