config/index.php:
[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
29 switch ($wgDBtype) {
30 case 'mysql':
31 $epoch = 'UNIX_TIMESTAMP(rev_timestamp)';
32 break;
33 case 'ibm_db2':
34 // TODO implement proper conversion to a Unix epoch
35 $epoch = 'rev_timestamp';
36 break;
37 case 'oracle':
38 $epoch = '((trunc(rev_timestamp) - to_date(\'19700101\',\'YYYYMMDD\')) * 86400)';
39 break;
40 default:
41 $epoch = 'EXTRACT(epoch FROM rev_timestamp)';
42 }
43
44 return
45 "SELECT 'Ancientpages' as type,
46 page_namespace as namespace,
47 page_title as title,
48 $epoch as value
49 FROM $page, $revision
50 WHERE page_namespace=".NS_MAIN." AND page_is_redirect=0
51 AND page_latest=rev_id";
52 }
53
54 function sortDescending() {
55 return false;
56 }
57
58 function formatResult( $skin, $result ) {
59 global $wgLang, $wgContLang;
60
61 $d = $wgLang->timeanddate( wfTimestamp( TS_MW, $result->value ), true );
62 $title = Title::makeTitle( $result->namespace, $result->title );
63 $link = $skin->linkKnown(
64 $title,
65 htmlspecialchars( $wgContLang->convert( $title->getPrefixedText() ) )
66 );
67 return wfSpecialList($link, htmlspecialchars($d) );
68 }
69 }
70
71 function wfSpecialAncientpages() {
72 list( $limit, $offset ) = wfCheckLimits();
73
74 $app = new AncientPagesPage();
75
76 $app->doQuery( $offset, $limit );
77 }