MediaWiki REL1_31
SpecialMostinterwikis.php
Go to the documentation of this file.
1<?php
26
33 function __construct( $name = 'Mostinterwikis' ) {
34 parent::__construct( $name );
35 }
36
37 public function isExpensive() {
38 return true;
39 }
40
41 function isSyndicated() {
42 return false;
43 }
44
45 public function getQueryInfo() {
46 return [
47 'tables' => [
48 'langlinks',
49 'page'
50 ], 'fields' => [
51 'namespace' => 'page_namespace',
52 'title' => 'page_title',
53 'value' => 'COUNT(*)'
54 ], 'conds' => [
55 'page_namespace' => MWNamespace::getContentNamespaces()
56 ], 'options' => [
57 'HAVING' => 'COUNT(*) > 1',
58 'GROUP BY' => [
59 'page_namespace',
60 'page_title'
61 ]
62 ], 'join_conds' => [
63 'page' => [
64 'LEFT JOIN',
65 'page_id = ll_from'
66 ]
67 ]
68 ];
69 }
70
77 function preprocessResults( $db, $res ) {
79 }
80
86 function formatResult( $skin, $result ) {
87 $title = Title::makeTitleSafe( $result->namespace, $result->title );
88 if ( !$title ) {
89 return Html::element(
90 'span',
91 [ 'class' => 'mw-invalidtitle' ],
93 $this->getContext(),
94 $result->namespace,
95 $result->title
96 )
97 );
98 }
99
101 if ( $this->isCached() ) {
102 $link = $linkRenderer->makeLink( $title );
103 } else {
104 $link = $linkRenderer->makeKnownLink( $title );
105 }
106
107 $count = $this->msg( 'ninterwikis' )->numParams( $result->value )->escaped();
108
109 return $this->getLanguage()->specialList( $link, $count );
110 }
111
112 protected function getGroupName() {
113 return 'highuse';
114 }
115}
static getInvalidTitleDescription(IContextSource $context, $namespace, $title)
Get a message saying that an invalid title was encountered.
Definition Linker.php:209
A special page that listed pages that have highest interwiki count.
__construct( $name='Mostinterwikis')
isExpensive()
Is this query expensive (for some definition of expensive)? Then we don't let it run in miser mode.
isSyndicated()
Sometime we don't want to build rss / atom feeds.
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
preprocessResults( $db, $res)
Pre-fill the link cache.
getQueryInfo()
Subclasses return an SQL query here, formatted as an array with the following keys: tables => Table(s...
formatResult( $skin, $result)
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:34
executeLBFromResultWrapper(IResultWrapper $res, $ns=null)
Creates a new LinkBatch object, adds all pages from the passed ResultWrapper (MUST include title and ...
isCached()
Whether or not the output of the page in question is retrieved from the database cache.
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.
MediaWiki Linker LinkRenderer null $linkRenderer
$res
Definition database.txt:21
usually copyright or history_copyright This message must be in HTML not wikitext & $link
Definition hooks.txt:3021
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.