5499857f12248e56622085a7858c4c2d58f9e876
[lhc/web/wiklou.git] / includes / SpecialAncientpages.php
1 <?php
2 /**
3 *
4 * @addtogroup SpecialPage
5 */
6
7 /**
8 *
9 * @addtogroup 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 #$use_index = $db->useIndexClause( 'cur_timestamp' ); # FIXME! this is gone
29 $epoch = $wgDBtype == 'mysql' ? 'UNIX_TIMESTAMP(rev_timestamp)' :
30 'EXTRACT(epoch FROM rev_timestamp)';
31 return
32 "SELECT 'Ancientpages' as type,
33 page_namespace as namespace,
34 page_title as title,
35 $epoch as value
36 FROM $page, $revision
37 WHERE page_namespace=".NS_MAIN." AND page_is_redirect=0
38 AND page_latest=rev_id";
39 }
40
41 function sortDescending() {
42 return false;
43 }
44
45 function formatResult( $skin, $result ) {
46 global $wgLang, $wgContLang;
47
48 $d = $wgLang->timeanddate( wfTimestamp( TS_MW, $result->value ), true );
49 $title = Title::makeTitle( $result->namespace, $result->title );
50 $link = $skin->makeKnownLinkObj( $title, htmlspecialchars( $wgContLang->convert( $title->getPrefixedText() ) ) );
51 return wfSpecialList($link, $d);
52 }
53 }
54
55 function wfSpecialAncientpages() {
56 list( $limit, $offset ) = wfCheckLimits();
57
58 $app = new AncientPagesPage();
59
60 $app->doQuery( $offset, $limit );
61 }
62
63 ?>