MediaWiki fundraising/REL1_35
SpecialFewestRevisions.php
Go to the documentation of this file.
1<?php
27
35 public function __construct( $name = 'Fewestrevisions' ) {
36 parent::__construct( $name );
37 }
38
39 public function isExpensive() {
40 return true;
41 }
42
43 public function isSyndicated() {
44 return false;
45 }
46
47 public function getQueryInfo() {
48 return [
49 'tables' => [ 'revision', 'page' ],
50 'fields' => [
51 'namespace' => 'page_namespace',
52 'title' => 'page_title',
53 'value' => 'COUNT(*)',
54 ],
55 'conds' => [
56 'page_namespace' => MediaWikiServices::getInstance()->getNamespaceInfo()->
57 getContentNamespaces(),
58 'page_id = rev_page',
59 'page_is_redirect = 0',
60 ],
61 'options' => [
62 'GROUP BY' => [ 'page_namespace', 'page_title' ]
63 ]
64 ];
65 }
66
67 protected function sortDescending() {
68 return false;
69 }
70
76 public function formatResult( $skin, $result ) {
77 $nt = Title::makeTitleSafe( $result->namespace, $result->title );
78 if ( !$nt ) {
79 return Html::element(
80 'span',
81 [ 'class' => 'mw-invalidtitle' ],
83 $this->getContext(),
84 $result->namespace,
85 $result->title
86 )
87 );
88 }
90
91 $text = $this->getLanguageConverter()->convertHtml( $nt->getPrefixedText() );
92 $plink = $linkRenderer->makeLink( $nt, new HtmlArmor( $text ) );
93
94 $nl = $this->msg( 'nrevisions' )->numParams( $result->value )->text();
95 $redirect = isset( $result->redirect ) && $result->redirect ?
96 ' - ' . $this->msg( 'isredirect' )->escaped() : '';
97 $nlink = $linkRenderer->makeKnownLink(
98 $nt,
99 $nl,
100 [],
101 [ 'action' => 'history' ]
102 ) . $redirect;
103
104 return $this->getLanguage()->specialList( $plink, $nlink );
105 }
106
113 protected function preprocessResults( $db, $res ) {
115 }
116
117 protected function getGroupName() {
118 return 'maintenance';
119 }
120}
Marks HTML that shouldn't be escaped.
Definition HtmlArmor.php:30
static getInvalidTitleDescription(IContextSource $context, $namespace, $title)
Get a message saying that an invalid title was encountered.
Definition Linker.php:188
MediaWikiServices is the service locator for the application scope of MediaWiki.
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:39
executeLBFromResultWrapper(IResultWrapper $res, $ns=null)
Creates a new LinkBatch object, adds all pages from the passed result wrapper (MUST include title and...
Special page for listing the articles with the fewest revisions.
__construct( $name='Fewestrevisions')
sortDescending()
Override to sort by increasing values.
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...
preprocessResults( $db, $res)
Cache page existence for performance.
getQueryInfo()
Subclasses return an SQL query here, formatted as an array with the following keys: tables => Table(s...
getLanguageConverter()
Shortcut to get language's converter.
getContext()
Gets the context this SpecialPage is executed in.
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
getLanguage()
Shortcut to get user's language.
MediaWiki Linker LinkRenderer null $linkRenderer
Basic database interface for live and lazy-loaded relation database handles.
Definition IDatabase.php:38
Result wrapper for grabbing data queried from an IDatabase object.