MediaWiki  1.34.0
SpecialMostInterwikis.php
Go to the documentation of this file.
1 <?php
27 
34  function __construct( $name = 'Mostinterwikis' ) {
35  parent::__construct( $name );
36  }
37 
38  public function isExpensive() {
39  return true;
40  }
41 
42  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  function preprocessResults( $db, $res ) {
81  }
82 
88  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 
102  $linkRenderer = $this->getLinkRenderer();
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 }
SpecialPage\msg
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
Definition: SpecialPage.php:792
MediaWiki\MediaWikiServices
MediaWikiServices is the service locator for the application scope of MediaWiki.
Definition: MediaWikiServices.php:117
SpecialMostInterwikis\getGroupName
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
Definition: SpecialMostInterwikis.php:114
SpecialMostInterwikis\preprocessResults
preprocessResults( $db, $res)
Pre-fill the link cache.
Definition: SpecialMostInterwikis.php:79
SpecialPage\getLanguage
getLanguage()
Shortcut to get user's language.
Definition: SpecialPage.php:749
Linker\getInvalidTitleDescription
static getInvalidTitleDescription(IContextSource $context, $namespace, $title)
Get a message saying that an invalid title was encountered.
Definition: Linker.php:187
$res
$res
Definition: testCompression.php:52
QueryPage
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:36
QueryPage\executeLBFromResultWrapper
executeLBFromResultWrapper(IResultWrapper $res, $ns=null)
Creates a new LinkBatch object, adds all pages from the passed result wrapper (MUST include title and...
Definition: QueryPage.php:800
Wikimedia\Rdbms\IDatabase
Basic database interface for live and lazy-loaded relation database handles.
Definition: IDatabase.php:38
Wikimedia\Rdbms\IResultWrapper
Result wrapper for grabbing data queried from an IDatabase object.
Definition: IResultWrapper.php:24
QueryPage\isCached
isCached()
Whether or not the output of the page in question is retrieved from the database cache.
Definition: QueryPage.php:258
$title
$title
Definition: testCompression.php:34
SpecialPage\getContext
getContext()
Gets the context this SpecialPage is executed in.
Definition: SpecialPage.php:692
SpecialMostInterwikis\isSyndicated
isSyndicated()
Sometime we don't want to build rss / atom feeds.
Definition: SpecialMostInterwikis.php:42
Title\makeTitleSafe
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:613
SpecialMostInterwikis\getQueryInfo
getQueryInfo()
Subclasses return an SQL query here, formatted as an array with the following keys: tables => Table(s...
Definition: SpecialMostInterwikis.php:46
SpecialMostInterwikis\__construct
__construct( $name='Mostinterwikis')
Definition: SpecialMostInterwikis.php:34
SpecialMostInterwikis\isExpensive
isExpensive()
Is this query expensive (for some definition of expensive)? Then we don't let it run in miser mode.
Definition: SpecialMostInterwikis.php:38
SpecialPage\getLinkRenderer
getLinkRenderer()
Definition: SpecialPage.php:904
SpecialPage\$linkRenderer
MediaWiki Linker LinkRenderer null $linkRenderer
Definition: SpecialPage.php:67
SpecialMostInterwikis\formatResult
formatResult( $skin, $result)
Definition: SpecialMostInterwikis.php:88
SpecialMostInterwikis
A special page that listed pages that have highest interwiki count.
Definition: SpecialMostInterwikis.php:33