MediaWiki  1.34.0
SpecialAncientPages.php
Go to the documentation of this file.
1 <?php
25 
32 
33  function __construct( $name = 'Ancientpages' ) {
34  parent::__construct( $name );
35  }
36 
37  public function isExpensive() {
38  return true;
39  }
40 
41  function isSyndicated() {
42  return false;
43  }
44 
45  public function getQueryInfo() {
46  $tables = [ 'page', 'revision' ];
47  $conds = [
48  'page_namespace' =>
49  MediaWikiServices::getInstance()->getNamespaceInfo()->getContentNamespaces(),
50  'page_is_redirect' => 0
51  ];
52  $joinConds = [
53  'revision' => [
54  'JOIN', [
55  'page_latest = rev_id'
56  ]
57  ],
58  ];
59 
60  // Allow extensions to modify the query
61  Hooks::run( 'AncientPagesQuery', [ &$tables, &$conds, &$joinConds ] );
62 
63  return [
64  'tables' => $tables,
65  'fields' => [
66  'namespace' => 'page_namespace',
67  'title' => 'page_title',
68  'value' => 'rev_timestamp'
69  ],
70  'conds' => $conds,
71  'join_conds' => $joinConds
72  ];
73  }
74 
75  public function usesTimestamps() {
76  return true;
77  }
78 
79  function sortDescending() {
80  return false;
81  }
82 
83  public function preprocessResults( $db, $res ) {
85  }
86 
92  function formatResult( $skin, $result ) {
93  $d = $this->getLanguage()->userTimeAndDate( $result->value, $this->getUser() );
94  $title = Title::makeTitle( $result->namespace, $result->title );
95  $linkRenderer = $this->getLinkRenderer();
96  $link = $linkRenderer->makeKnownLink(
97  $title,
98  new HtmlArmor( MediaWikiServices::getInstance()->getContentLanguage()->
99  convert( htmlspecialchars( $title->getPrefixedText() ) ) )
100  );
101 
102  return $this->getLanguage()->specialList( $link, htmlspecialchars( $d ) );
103  }
104 
105  protected function getGroupName() {
106  return 'maintenance';
107  }
108 }
HtmlArmor
Marks HTML that shouldn't be escaped.
Definition: HtmlArmor.php:28
SpecialAncientPages\formatResult
formatResult( $skin, $result)
Definition: SpecialAncientPages.php:92
SpecialAncientPages\getGroupName
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
Definition: SpecialAncientPages.php:105
SpecialAncientPages\__construct
__construct( $name='Ancientpages')
Definition: SpecialAncientPages.php:33
MediaWiki\MediaWikiServices
MediaWikiServices is the service locator for the application scope of MediaWiki.
Definition: MediaWikiServices.php:117
SpecialAncientPages
Implements Special:Ancientpages.
Definition: SpecialAncientPages.php:31
SpecialAncientPages\preprocessResults
preprocessResults( $db, $res)
Do any necessary preprocessing of the result object.
Definition: SpecialAncientPages.php:83
SpecialPage\getLanguage
getLanguage()
Shortcut to get user's language.
Definition: SpecialPage.php:749
$res
$res
Definition: testCompression.php:52
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:800
SpecialAncientPages\sortDescending
sortDescending()
Override to sort by increasing values.
Definition: SpecialAncientPages.php:79
SpecialAncientPages\getQueryInfo
getQueryInfo()
Subclasses return an SQL query here, formatted as an array with the following keys: tables => Table(s...
Definition: SpecialAncientPages.php:45
$title
$title
Definition: testCompression.php:34
Title\makeTitle
static makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:586
SpecialAncientPages\isSyndicated
isSyndicated()
Sometime we don't want to build rss / atom feeds.
Definition: SpecialAncientPages.php:41
SpecialAncientPages\isExpensive
isExpensive()
Is this query expensive (for some definition of expensive)? Then we don't let it run in miser mode.
Definition: SpecialAncientPages.php:37
SpecialPage\getLinkRenderer
getLinkRenderer()
Definition: SpecialPage.php:904
SpecialPage\$linkRenderer
MediaWiki Linker LinkRenderer null $linkRenderer
Definition: SpecialPage.php:67
Hooks\run
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
Definition: Hooks.php:200
SpecialAncientPages\usesTimestamps
usesTimestamps()
Does this query return timestamps rather than integers in its 'value' field? If true,...
Definition: SpecialAncientPages.php:75