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