MediaWiki REL1_40
SpecialAncientPages.php
Go to the documentation of this file.
1<?php
28
35
37 private $namespaceInfo;
38
40 private $languageConverter;
41
48 public function __construct(
49 NamespaceInfo $namespaceInfo,
50 ILoadBalancer $loadBalancer,
51 LinkBatchFactory $linkBatchFactory,
52 LanguageConverterFactory $languageConverterFactory
53 ) {
54 parent::__construct( 'Ancientpages' );
55 $this->namespaceInfo = $namespaceInfo;
56 $this->setDBLoadBalancer( $loadBalancer );
57 $this->setLinkBatchFactory( $linkBatchFactory );
58 $this->languageConverter = $languageConverterFactory->getLanguageConverter( $this->getContentLanguage() );
59 }
60
61 public function isExpensive() {
62 return true;
63 }
64
65 public function isSyndicated() {
66 return false;
67 }
68
69 public function getQueryInfo() {
70 $tables = [ 'page', 'revision' ];
71 $conds = [
72 'page_namespace' => $this->namespaceInfo->getContentNamespaces(),
73 'page_is_redirect' => 0
74 ];
75 $joinConds = [
76 'revision' => [
77 'JOIN', [
78 'page_latest = rev_id'
79 ]
80 ],
81 ];
82
83 // Allow extensions to modify the query
84 $this->getHookRunner()->onAncientPagesQuery( $tables, $conds, $joinConds );
85
86 return [
87 'tables' => $tables,
88 'fields' => [
89 'namespace' => 'page_namespace',
90 'title' => 'page_title',
91 'value' => 'rev_timestamp'
92 ],
93 'conds' => $conds,
94 'join_conds' => $joinConds
95 ];
96 }
97
98 public function usesTimestamps() {
99 return true;
100 }
101
102 protected function sortDescending() {
103 return false;
104 }
105
106 public function preprocessResults( $db, $res ) {
108 }
109
115 public function formatResult( $skin, $result ) {
116 $d = $this->getLanguage()->userTimeAndDate( $result->value, $this->getUser() );
117 $title = Title::makeTitle( $result->namespace, $result->title );
118 $linkRenderer = $this->getLinkRenderer();
119
120 $link = $linkRenderer->makeKnownLink(
121 $title,
122 new HtmlArmor( $this->languageConverter->convertHtml( $title->getPrefixedText() ) )
123 );
124
125 return $this->getLanguage()->specialList( $link, htmlspecialchars( $d ) );
126 }
127
128 protected function getGroupName() {
129 return 'maintenance';
130 }
131}
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.
Represents a title within MediaWiki.
Definition Title.php:82
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:45
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)
setLinkBatchFactory(LinkBatchFactory $linkBatchFactory)
Implements Special:Ancientpages.
isSyndicated()
Sometimes 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()
Should this query page only be updated offline on large wikis?
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)
getLanguage()
Shortcut to get user's language.
getContentLanguage()
Shortcut to get content language.
The shared interface for all language converters.
This class is a delegate to ILBFactory for a given database cluster.