MediaWiki  1.27.2
SpecialLonelypages.php
Go to the documentation of this file.
1 <?php
31  function __construct( $name = 'Lonelypages' ) {
32  parent::__construct( $name );
33  }
34 
35  function getPageHeader() {
36  return $this->msg( 'lonelypagestext' )->parseAsBlock();
37  }
38 
39  function sortDescending() {
40  return false;
41  }
42 
43  function isExpensive() {
44  return true;
45  }
46 
47  function isSyndicated() {
48  return false;
49  }
50 
51  function getQueryInfo() {
52  $tables = [ 'page', 'pagelinks', 'templatelinks' ];
53  $conds = [
54  'pl_namespace IS NULL',
55  'page_namespace' => MWNamespace::getContentNamespaces(),
56  'page_is_redirect' => 0,
57  'tl_namespace IS NULL'
58  ];
59  $joinConds = [
60  'pagelinks' => [
61  'LEFT JOIN', [
62  'pl_namespace = page_namespace',
63  'pl_title = page_title'
64  ]
65  ],
66  'templatelinks' => [
67  'LEFT JOIN', [
68  'tl_namespace = page_namespace',
69  'tl_title = page_title'
70  ]
71  ]
72  ];
73 
74  // Allow extensions to modify the query
75  Hooks::run( 'LonelyPagesQuery', [ &$tables, &$conds, &$joinConds ] );
76 
77  return [
78  'tables' => $tables,
79  'fields' => [
80  'namespace' => 'page_namespace',
81  'title' => 'page_title',
82  'value' => 'page_title'
83  ],
84  'conds' => $conds,
85  'join_conds' => $joinConds
86  ];
87  }
88 
89  function getOrderFields() {
90  // For some crazy reason ordering by a constant
91  // causes a filesort in MySQL 5
92  if ( count( MWNamespace::getContentNamespaces() ) > 1 ) {
93  return [ 'page_namespace', 'page_title' ];
94  } else {
95  return [ 'page_title' ];
96  }
97  }
98 
99  protected function getGroupName() {
100  return 'maintenance';
101  }
102 }
__construct($name= 'Lonelypages')
A special page looking for articles with no article linking to them, thus being lonely.
msg()
Wrapper around wfMessage that sets the current context.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist & $tables
Definition: hooks.txt:965
static getContentNamespaces()
Get a list of all namespace indices which are considered to contain content.
static run($event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
Definition: Hooks.php:131
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:35
Variant of QueryPage which formats the result as a simple link to the page.
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:310