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  'value' => 'page_title'
88  ],
89  'conds' => [
90  'pl_from IS NULL',
91  'page_namespace' => $this->namespaceInfo->getContentNamespaces(),
92  'page_is_redirect' => 0
93  ],
94  'join_conds' => [
95  'pagelinks' => [
96  'LEFT JOIN',
97  [ 'page_id=pl_from' ]
98  ]
99  ]
100  ];
101  }
102 
103  protected function getOrderFields() {
104  // For some crazy reason ordering by a constant
105  // causes a filesort
106  if ( count( $this->namespaceInfo->getContentNamespaces() ) > 1 ) {
107  return [ 'page_namespace', 'page_title' ];
108  } else {
109  return [ 'page_title' ];
110  }
111  }
112 
113  protected function getGroupName() {
114  return 'maintenance';
115  }
116 }
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:900
SpecialDeadendPages\$namespaceInfo
NamespaceInfo $namespaceInfo
Definition: SpecialDeadendPages.php:36
MediaWiki\Languages\LanguageConverterFactory
An interface for creating language converters.
Definition: LanguageConverterFactory.php:44
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:136
SpecialDeadendPages\getGroupName
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
Definition: SpecialDeadendPages.php:113
MediaWiki\Languages\LanguageConverterFactory\getLanguageConverter
getLanguageConverter( $language=null)
Provide a LanguageConverter for given language.
Definition: LanguageConverterFactory.php:121
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:38
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:873
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:103
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