MediaWiki  1.34.0
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 }
SpecialPage\msg
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
Definition: SpecialPage.php:792
MediaWiki\MediaWikiServices
MediaWikiServices is the service locator for the application scope of MediaWiki.
Definition: MediaWikiServices.php:117
SpecialLonelyPages\getOrderFields
getOrderFields()
Subclasses return an array of fields to order by here.
Definition: SpecialLonelyPages.php:91
SpecialLonelyPages\isSyndicated
isSyndicated()
Sometime we don't want to build rss / atom feeds.
Definition: SpecialLonelyPages.php:49
SpecialLonelyPages\sortDescending
sortDescending()
Override to sort by increasing values.
Definition: SpecialLonelyPages.php:41
SpecialLonelyPages\isExpensive
isExpensive()
Is this query expensive (for some definition of expensive)? Then we don't let it run in miser mode.
Definition: SpecialLonelyPages.php:45
PageQueryPage
Variant of QueryPage which formats the result as a simple link to the page.
Definition: PageQueryPage.php:33
SpecialLonelyPages\getPageHeader
getPageHeader()
The content returned by this function will be output before any result.
Definition: SpecialLonelyPages.php:37
SpecialLonelyPages
A special page looking for articles with no article linking to them, thus being lonely.
Definition: SpecialLonelyPages.php:32
SpecialLonelyPages\getQueryInfo
getQueryInfo()
Subclasses return an SQL query here, formatted as an array with the following keys: tables => Table(s...
Definition: SpecialLonelyPages.php:53
SpecialLonelyPages\getGroupName
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
Definition: SpecialLonelyPages.php:103
SpecialLonelyPages\__construct
__construct( $name='Lonelypages')
Definition: SpecialLonelyPages.php:33
Hooks\run
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
Definition: Hooks.php:200