MediaWiki REL1_37
SpecialAncientPages.php
Go to the documentation of this file.
1<?php
27
34
37
40
47 public function __construct(
51 LanguageConverterFactory $languageConverterFactory
52 ) {
53 parent::__construct( 'Ancientpages' );
54 $this->namespaceInfo = $namespaceInfo;
55 $this->setDBLoadBalancer( $loadBalancer );
56 $this->setLinkBatchFactory( $linkBatchFactory );
57 $this->languageConverter = $languageConverterFactory->getLanguageConverter( $this->getContentLanguage() );
58 }
59
60 public function isExpensive() {
61 return true;
62 }
63
64 public function isSyndicated() {
65 return false;
66 }
67
68 public function getQueryInfo() {
69 $tables = [ 'page', 'revision' ];
70 $conds = [
71 'page_namespace' => $this->namespaceInfo->getContentNamespaces(),
72 'page_is_redirect' => 0
73 ];
74 $joinConds = [
75 'revision' => [
76 'JOIN', [
77 'page_latest = rev_id'
78 ]
79 ],
80 ];
81
82 // Allow extensions to modify the query
83 $this->getHookRunner()->onAncientPagesQuery( $tables, $conds, $joinConds );
84
85 return [
86 'tables' => $tables,
87 'fields' => [
88 'namespace' => 'page_namespace',
89 'title' => 'page_title',
90 'value' => 'rev_timestamp'
91 ],
92 'conds' => $conds,
93 'join_conds' => $joinConds
94 ];
95 }
96
97 public function usesTimestamps() {
98 return true;
99 }
100
101 protected function sortDescending() {
102 return false;
103 }
104
105 public function preprocessResults( $db, $res ) {
107 }
108
114 public function formatResult( $skin, $result ) {
115 $d = $this->getLanguage()->userTimeAndDate( $result->value, $this->getUser() );
116 $title = Title::makeTitle( $result->namespace, $result->title );
118
120 $title,
121 new HtmlArmor( $this->languageConverter->convertHtml( $title->getPrefixedText() ) )
122 );
123
124 return $this->getLanguage()->specialList( $link, htmlspecialchars( $d ) );
125 }
126
127 protected function getGroupName() {
128 return 'maintenance';
129 }
130}
Marks HTML that shouldn't be escaped.
Definition HtmlArmor.php:30
An interface for creating language converters.
getLanguageConverter( $language=null)
Provide a LanguageConverter for given language.
makeKnownLink( $target, $text=null, array $extraAttribs=[], array $query=[])
This is a utility class for dealing with namespaces that encodes all the "magic" behaviors of them ba...
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:41
executeLBFromResultWrapper(IResultWrapper $res, $ns=null)
Creates a new LinkBatch object, adds all pages from the passed result wrapper (MUST include title and...
setDBLoadBalancer(ILoadBalancer $loadBalancer)
LinkBatchFactory null $linkBatchFactory
Definition QueryPage.php:74
setLinkBatchFactory(LinkBatchFactory $linkBatchFactory)
ILoadBalancer null $loadBalancer
Definition QueryPage.php:71
Implements Special:Ancientpages.
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.
ILanguageConverter $languageConverter
getQueryInfo()
Subclasses return an SQL query here, formatted as an array with the following keys: tables => Table(s...
usesTimestamps()
Does this query return timestamps rather than integers in its 'value' field? If true,...
preprocessResults( $db, $res)
Do any necessary preprocessing of the result object.
sortDescending()
Override to sort by increasing values.
formatResult( $skin, $result)
__construct(NamespaceInfo $namespaceInfo, ILoadBalancer $loadBalancer, LinkBatchFactory $linkBatchFactory, LanguageConverterFactory $languageConverterFactory)
LinkRenderer null $linkRenderer
getLanguage()
Shortcut to get user's language.
getContentLanguage()
Shortcut to get content language.
The shared interface for all language converters.
Database cluster connection, tracking, load balancing, and transaction manager interface.