MediaWiki REL1_34
SpecialLonelyPages.php
Go to the documentation of this file.
1<?php
25
33 function __construct( $name = 'Lonelypages' ) {
34 parent::__construct( $name );
35 }
36
37 function getPageHeader() {
38 return $this->msg( 'lonelypagestext' )->parseAsBlock();
39 }
40
41 function sortDescending() {
42 return false;
43 }
44
45 function isExpensive() {
46 return true;
47 }
48
49 function isSyndicated() {
50 return false;
51 }
52
53 function getQueryInfo() {
54 $tables = [ 'page', 'pagelinks', 'templatelinks' ];
55 $conds = [
56 'pl_namespace IS NULL',
57 'page_namespace' => MediaWikiServices::getInstance()->getNamespaceInfo()->
58 getContentNamespaces(),
59 'page_is_redirect' => 0,
60 'tl_namespace IS NULL'
61 ];
62 $joinConds = [
63 'pagelinks' => [
64 'LEFT JOIN', [
65 'pl_namespace = page_namespace',
66 'pl_title = page_title'
67 ]
68 ],
69 'templatelinks' => [
70 'LEFT JOIN', [
71 'tl_namespace = page_namespace',
72 'tl_title = page_title'
73 ]
74 ]
75 ];
76
77 // Allow extensions to modify the query
78 Hooks::run( 'LonelyPagesQuery', [ &$tables, &$conds, &$joinConds ] );
79
80 return [
81 'tables' => $tables,
82 'fields' => [
83 'namespace' => 'page_namespace',
84 'title' => 'page_title',
85 ],
86 'conds' => $conds,
87 'join_conds' => $joinConds
88 ];
89 }
90
91 function getOrderFields() {
92 // For some crazy reason ordering by a constant
93 // causes a filesort in MySQL 5
94 if ( count( MediaWikiServices::getInstance()->getNamespaceInfo()->
95 getContentNamespaces() ) > 1
96 ) {
97 return [ 'page_namespace', 'page_title' ];
98 } else {
99 return [ 'page_title' ];
100 }
101 }
102
103 protected function getGroupName() {
104 return 'maintenance';
105 }
106}
MediaWikiServices is the service locator for the application scope of MediaWiki.
Variant of QueryPage which formats the result as a simple link to the page.
A special page looking for articles with no article linking to them, thus being lonely.
isExpensive()
Is this query expensive (for some definition of expensive)? Then we don't let it run in miser mode.
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...
__construct( $name='Lonelypages')
getOrderFields()
Subclasses return an array of fields to order by here.
isSyndicated()
Sometime we don't want to build rss / atom feeds.
getPageHeader()
The content returned by this function will be output before any result.
sortDescending()
Override to sort by increasing values.
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.