MediaWiki REL1_35
SpecialMostInterwikis.php
Go to the documentation of this file.
1<?php
27
34 public function __construct( $name = 'Mostinterwikis' ) {
35 parent::__construct( $name );
36 }
37
38 public function isExpensive() {
39 return true;
40 }
41
42 public function isSyndicated() {
43 return false;
44 }
45
46 public function getQueryInfo() {
47 return [
48 'tables' => [
49 'langlinks',
50 'page'
51 ], 'fields' => [
52 'namespace' => 'page_namespace',
53 'title' => 'page_title',
54 'value' => 'COUNT(*)'
55 ], 'conds' => [
56 'page_namespace' =>
57 MediaWikiServices::getInstance()->getNamespaceInfo()->getContentNamespaces()
58 ], 'options' => [
59 'HAVING' => 'COUNT(*) > 1',
60 'GROUP BY' => [
61 'page_namespace',
62 'page_title'
63 ]
64 ], 'join_conds' => [
65 'page' => [
66 'LEFT JOIN',
67 'page_id = ll_from'
68 ]
69 ]
70 ];
71 }
72
79 public function preprocessResults( $db, $res ) {
81 }
82
88 public function formatResult( $skin, $result ) {
89 $title = Title::makeTitleSafe( $result->namespace, $result->title );
90 if ( !$title ) {
91 return Html::element(
92 'span',
93 [ 'class' => 'mw-invalidtitle' ],
95 $this->getContext(),
96 $result->namespace,
97 $result->title
98 )
99 );
100 }
101
103 if ( $this->isCached() ) {
104 $link = $linkRenderer->makeLink( $title );
105 } else {
106 $link = $linkRenderer->makeKnownLink( $title );
107 }
108
109 $count = $this->msg( 'ninterwikis' )->numParams( $result->value )->escaped();
110
111 return $this->getLanguage()->specialList( $link, $count );
112 }
113
114 protected function getGroupName() {
115 return 'highuse';
116 }
117}
static getInvalidTitleDescription(IContextSource $context, $namespace, $title)
Get a message saying that an invalid title was encountered.
Definition Linker.php:188
MediaWikiServices is the service locator for the application scope of MediaWiki.
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:39
executeLBFromResultWrapper(IResultWrapper $res, $ns=null)
Creates a new LinkBatch object, adds all pages from the passed result wrapper (MUST include title and...
isCached()
Whether or not the output of the page in question is retrieved from the database cache.
A special page that listed pages that have highest interwiki count.
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...
__construct( $name='Mostinterwikis')
getQueryInfo()
Subclasses return an SQL query here, formatted as an array with the following keys: tables => Table(s...
isExpensive()
Is this query expensive (for some definition of expensive)? Then we don't let it run in miser mode.
preprocessResults( $db, $res)
Pre-fill the link cache.
getContext()
Gets the context this SpecialPage is executed in.
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
getLanguage()
Shortcut to get user's language.
MediaWiki Linker LinkRenderer null $linkRenderer
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.