MediaWiki  master
SpecialMostLinkedCategories.php
Go to the documentation of this file.
1 <?php
29 
36  public function __construct( $name = 'Mostlinkedcategories' ) {
37  parent::__construct( $name );
38  }
39 
40  public function isSyndicated() {
41  return false;
42  }
43 
44  public function getQueryInfo() {
45  return [
46  'tables' => [ 'category' ],
47  'fields' => [ 'title' => 'cat_title',
48  'namespace' => NS_CATEGORY,
49  'value' => 'cat_pages' ],
50  'conds' => [ 'cat_pages > 0' ],
51  ];
52  }
53 
54  protected function sortDescending() {
55  return true;
56  }
57 
64  public function preprocessResults( $db, $res ) {
66  }
67 
73  public function formatResult( $skin, $result ) {
74  $nt = Title::makeTitleSafe( NS_CATEGORY, $result->title );
75  if ( !$nt ) {
76  return Html::element(
77  'span',
78  [ 'class' => 'mw-invalidtitle' ],
80  $this->getContext(),
82  $result->title )
83  );
84  }
85 
86  $text = $this->getLanguageConverter()->convertHtml( $nt->getText() );
87 
88  $plink = $this->getLinkRenderer()->makeLink( $nt, new HtmlArmor( $text ) );
89  $nlinks = $this->msg( 'nmembers' )->numParams( $result->value )->escaped();
90 
91  return $this->getLanguage()->specialList( $plink, $nlinks );
92  }
93 
94  protected function getGroupName() {
95  return 'highuse';
96  }
97 }
SpecialPage\msg
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
Definition: SpecialPage.php:800
HtmlArmor
Marks HTML that shouldn't be escaped.
Definition: HtmlArmor.php:28
SpecialMostLinkedCategories\isSyndicated
isSyndicated()
Sometime we don't want to build rss / atom feeds.
Definition: SpecialMostLinkedCategories.php:40
SpecialMostLinkedCategories\preprocessResults
preprocessResults( $db, $res)
Fetch user page links and cache their existence.
Definition: SpecialMostLinkedCategories.php:64
SpecialPage\getLanguage
getLanguage()
Shortcut to get user's language.
Definition: SpecialPage.php:746
Linker\getInvalidTitleDescription
static getInvalidTitleDescription(IContextSource $context, $namespace, $title)
Get a message saying that an invalid title was encountered.
Definition: Linker.php:188
$res
$res
Definition: testCompression.php:57
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:801
Wikimedia\Rdbms\IDatabase
Basic database interface for live and lazy-loaded relation database handles.
Definition: IDatabase.php:38
SpecialMostLinkedCategories\__construct
__construct( $name='Mostlinkedcategories')
Definition: SpecialMostLinkedCategories.php:36
Wikimedia\Rdbms\IResultWrapper
Result wrapper for grabbing data queried from an IDatabase object.
Definition: IResultWrapper.php:24
SpecialMostLinkedCategories\formatResult
formatResult( $skin, $result)
Definition: SpecialMostLinkedCategories.php:73
NS_CATEGORY
const NS_CATEGORY
Definition: Defines.php:83
SpecialPage\getContext
getContext()
Gets the context this SpecialPage is executed in.
Definition: SpecialPage.php:689
SpecialMostLinkedCategories\sortDescending
sortDescending()
Override to sort by increasing values.
Definition: SpecialMostLinkedCategories.php:54
Title\makeTitleSafe
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:621
SpecialMostLinkedCategories\getQueryInfo
getQueryInfo()
Subclasses return an SQL query here, formatted as an array with the following keys: tables => Table(s...
Definition: SpecialMostLinkedCategories.php:44
SpecialPage\getLinkRenderer
getLinkRenderer()
Definition: SpecialPage.php:912
SpecialPage\getLanguageConverter
getLanguageConverter()
Shortcut to get language's converter.
Definition: SpecialPage.php:756
Html\element
static element( $element, $attribs=[], $contents='')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
Definition: Html.php:231
SpecialMostLinkedCategories
A querypage to show categories ordered in descending order by the pages in them.
Definition: SpecialMostLinkedCategories.php:35
SpecialMostLinkedCategories\getGroupName
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
Definition: SpecialMostLinkedCategories.php:94