MediaWiki  master
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 }
static element( $element, $attribs=[], $contents='')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
Definition: Html.php:231
getContext()
Gets the context this SpecialPage is executed in.
isCached()
Whether or not the output of the page in question is retrieved from the database cache.
Definition: QueryPage.php:258
This is a class for doing query pages; since they&#39;re almost all the same, we factor out some of the f...
Definition: QueryPage.php:36
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:612
__construct( $name='Mostinterwikis')
getLanguage()
Shortcut to get user&#39;s language.
preprocessResults( $db, $res)
Pre-fill the link cache.
static getInvalidTitleDescription(IContextSource $context, $namespace, $title)
Get a message saying that an invalid title was encountered.
Definition: Linker.php:187
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
A special page that listed pages that have highest interwiki count.
MediaWiki Linker LinkRenderer null $linkRenderer
Definition: SpecialPage.php:67