MediaWiki REL1_31
SpecialFewestrevisions.php
Go to the documentation of this file.
1<?php
31 function __construct( $name = 'Fewestrevisions' ) {
32 parent::__construct( $name );
33 }
34
35 public function isExpensive() {
36 return true;
37 }
38
39 function isSyndicated() {
40 return false;
41 }
42
43 public function getQueryInfo() {
44 return [
45 'tables' => [ 'revision', 'page' ],
46 'fields' => [
47 'namespace' => 'page_namespace',
48 'title' => 'page_title',
49 'value' => 'COUNT(*)',
50 'redirect' => 'page_is_redirect'
51 ],
52 'conds' => [
53 'page_namespace' => MWNamespace::getContentNamespaces(),
54 'page_id = rev_page' ],
55 'options' => [
56 'GROUP BY' => [ 'page_namespace', 'page_title', 'page_is_redirect' ]
57 ]
58 ];
59 }
60
61 function sortDescending() {
62 return false;
63 }
64
70 function formatResult( $skin, $result ) {
71 global $wgContLang;
72
73 $nt = Title::makeTitleSafe( $result->namespace, $result->title );
74 if ( !$nt ) {
75 return Html::element(
76 'span',
77 [ 'class' => 'mw-invalidtitle' ],
79 $this->getContext(),
80 $result->namespace,
81 $result->title
82 )
83 );
84 }
86 $text = $wgContLang->convert( $nt->getPrefixedText() );
87 $plink = $linkRenderer->makeLink( $nt, $text );
88
89 $nl = $this->msg( 'nrevisions' )->numParams( $result->value )->text();
90 $redirect = isset( $result->redirect ) && $result->redirect ?
91 ' - ' . $this->msg( 'isredirect' )->escaped() : '';
92 $nlink = $linkRenderer->makeKnownLink(
93 $nt,
94 $nl,
95 [],
96 [ 'action' => 'history' ]
97 ) . $redirect;
98
99 return $this->getLanguage()->specialList( $plink, $nlink );
100 }
101
102 protected function getGroupName() {
103 return 'maintenance';
104 }
105}
Special page for listing the articles with the fewest revisions.
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...
isExpensive()
Is this query expensive (for some definition of expensive)? Then we don't let it run in miser mode.
sortDescending()
Override to sort by increasing values.
getQueryInfo()
Subclasses return an SQL query here, formatted as an array with the following keys: tables => Table(s...
__construct( $name='Fewestrevisions')
static getInvalidTitleDescription(IContextSource $context, $namespace, $title)
Get a message saying that an invalid title was encountered.
Definition Linker.php:209
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
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
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the local content language as $wgContLang
Definition design.txt:57