MediaWiki  1.33.0
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
93  return [ 'page_namespace', 'page_title' ];
94  } else {
95  return [ 'page_title' ];
96  }
97  }
98 
99  protected function getGroupName() {
100  return 'maintenance';
101  }
102 }
SpecialPage\msg
msg( $key)
Wrapper around wfMessage that sets the current context.
Definition: SpecialPage.php:796
LonelyPagesPage\isExpensive
isExpensive()
Is this query expensive (for some definition of expensive)? Then we don't let it run in miser mode.
Definition: SpecialLonelypages.php:43
captcha-old.count
count
Definition: captcha-old.py:249
LonelyPagesPage\getOrderFields
getOrderFields()
Subclasses return an array of fields to order by here.
Definition: SpecialLonelypages.php:89
$tables
this hook is for auditing only RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist & $tables
Definition: hooks.txt:979
MWNamespace\getContentNamespaces
static getContentNamespaces()
Get a list of all namespace indices which are considered to contain content.
Definition: MWNamespace.php:375
php
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
PageQueryPage
Variant of QueryPage which formats the result as a simple link to the page.
Definition: PageQueryPage.php:33
LonelyPagesPage\isSyndicated
isSyndicated()
Sometime we don't want to build rss / atom feeds.
Definition: SpecialLonelypages.php:47
LonelyPagesPage\sortDescending
sortDescending()
Override to sort by increasing values.
Definition: SpecialLonelypages.php:39
$name
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:271
LonelyPagesPage\getPageHeader
getPageHeader()
The content returned by this function will be output before any result.
Definition: SpecialLonelypages.php:35
LonelyPagesPage\getGroupName
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
Definition: SpecialLonelypages.php:99
Hooks\run
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
Definition: Hooks.php:200
LonelyPagesPage
A special page looking for articles with no article linking to them, thus being lonely.
Definition: SpecialLonelypages.php:30
LonelyPagesPage\getQueryInfo
getQueryInfo()
Subclasses return an SQL query here, formatted as an array with the following keys: tables => Table(s...
Definition: SpecialLonelypages.php:51
LonelyPagesPage\__construct
__construct( $name='Lonelypages')
Definition: SpecialLonelypages.php:31