Set values from query params (bug 12750)
[lhc/web/wiklou.git] / includes / specials / SpecialAncientpages.php
1 <?php
2 /**
3 * @file
4 * @ingroup SpecialPage
5 */
6
7 /**
8 * Implements Special:Ancientpages
9 * @ingroup SpecialPage
10 */
11 class AncientPagesPage extends QueryPage {
12
13 function getName() {
14 return "Ancientpages";
15 }
16
17 function isExpensive() {
18 return true;
19 }
20
21 function isSyndicated() { return false; }
22
23 function getSQL() {
24 global $wgDBtype;
25 $db = wfGetDB( DB_SLAVE );
26 $page = $db->tableName( 'page' );
27 $revision = $db->tableName( 'revision' );
28 $epoch = $wgDBtype == 'mysql' ? 'UNIX_TIMESTAMP(rev_timestamp)' :
29 'EXTRACT(epoch FROM rev_timestamp)';
30 return
31 "SELECT 'Ancientpages' as type,
32 page_namespace as namespace,
33 page_title as title,
34 $epoch as value
35 FROM $page, $revision
36 WHERE page_namespace=".NS_MAIN." AND page_is_redirect=0
37 AND page_latest=rev_id";
38 }
39
40 function sortDescending() {
41 return false;
42 }
43
44 function formatResult( $skin, $result ) {
45 global $wgLang, $wgContLang;
46
47 $d = $wgLang->timeanddate( wfTimestamp( TS_MW, $result->value ), true );
48 $title = Title::makeTitle( $result->namespace, $result->title );
49 $link = $skin->makeKnownLinkObj( $title, htmlspecialchars( $wgContLang->convert( $title->getPrefixedText() ) ) );
50 return wfSpecialList($link, $d);
51 }
52 }
53
54 function wfSpecialAncientpages() {
55 list( $limit, $offset ) = wfCheckLimits();
56
57 $app = new AncientPagesPage();
58
59 $app->doQuery( $offset, $limit );
60 }