MediaWiki REL1_32
SpecialMostlinkedtemplates.php
Go to the documentation of this file.
1<?php
27
35 function __construct( $name = 'Mostlinkedtemplates' ) {
36 parent::__construct( $name );
37 }
38
44 public function isExpensive() {
45 return true;
46 }
47
53 public function isSyndicated() {
54 return false;
55 }
56
62 public function sortDescending() {
63 return true;
64 }
65
66 public function getQueryInfo() {
67 return [
68 'tables' => [ 'templatelinks' ],
69 'fields' => [
70 'namespace' => 'tl_namespace',
71 'title' => 'tl_title',
72 'value' => 'COUNT(*)'
73 ],
74 'options' => [ 'GROUP BY' => [ 'tl_namespace', 'tl_title' ] ]
75 ];
76 }
77
84 public function preprocessResults( $db, $res ) {
86 }
87
95 public function formatResult( $skin, $result ) {
96 $title = Title::makeTitleSafe( $result->namespace, $result->title );
97 if ( !$title ) {
98 return Html::element(
99 'span',
100 [ 'class' => 'mw-invalidtitle' ],
102 $this->getContext(),
103 $result->namespace,
104 $result->title
105 )
106 );
107 }
108
109 return $this->getLanguage()->specialList(
110 $this->getLinkRenderer()->makeLink( $title ),
111 $this->makeWlhLink( $title, $result )
112 );
113 }
114
122 private function makeWlhLink( $title, $result ) {
123 $wlh = SpecialPage::getTitleFor( 'Whatlinkshere', $title->getPrefixedText() );
124 $label = $this->msg( 'ntransclusions' )->numParams( $result->value )->text();
125
126 return $this->getLinkRenderer()->makeLink( $wlh, $label );
127 }
128
129 protected function getGroupName() {
130 return 'highuse';
131 }
132}
static getInvalidTitleDescription(IContextSource $context, $namespace, $title)
Get a message saying that an invalid title was encountered.
Definition Linker.php:186
Special page lists templates with a large number of transclusion links, i.e.
makeWlhLink( $title, $result)
Make a "what links here" link for a given title.
sortDescending()
Sort the results in descending order?
isExpensive()
Is this report expensive, i.e should it be cached?
__construct( $name='Mostlinkedtemplates')
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...
preprocessResults( $db, $res)
Pre-cache page existence to speed up link generation.
formatResult( $skin, $result)
Format a result row.
isSyndicated()
Is there a feed available?
This is a class for doing query pages; since they're almost all the same, we factor out some of the f...
Definition QueryPage.php:35
executeLBFromResultWrapper(IResultWrapper $res, $ns=null)
Creates a new LinkBatch object, adds all pages from the passed ResultWrapper (MUST include title and ...
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
getContext()
Gets the context this SpecialPage is executed in.
msg( $key)
Wrapper around wfMessage that sets the current context.
getLanguage()
Shortcut to get user's language.
$res
Definition database.txt:21
Basic database interface for live and lazy-loaded relation database handles.
Definition IDatabase.php:38
Result wrapper for grabbing data queried from an IDatabase object.