* Support for table name prefixes throughout the code. No support yet for converting...
[lhc/web/wiklou.git] / includes / SpecialAncientpages.php
index aadf79b..6029f06 100644 (file)
@@ -1,6 +1,6 @@
-<?
+<?php
 
-include_once( "QueryPage.php" );
+require_once( "QueryPage.php" );
 
 class AncientPagesPage extends QueryPage {
 
@@ -12,18 +12,28 @@ class AncientPagesPage extends QueryPage {
                return parent::isExpensive() ;
        }
 
-       function getSQL( $offset, $limit ) {
-               return "SELECT cur_title, cur_timestamp " . 
-                 "FROM cur USE INDEX (cur_timestamp) " .
-                 "WHERE cur_namespace=0 AND cur_is_redirect=0 " .
-                 " ORDER BY cur_timestamp LIMIT {$offset}, {$limit}";
+       function getSQL() {
+               $db =& wfGetDB( DB_SLAVE );
+               $cur = $db->tableName( 'cur' );
+               $use_index = $db->useIndexClause( 'cur_timestamp' );
+               return
+                       "SELECT 'Ancientpages' as type,
+                                       cur_namespace as namespace,
+                               cur_title as title,
+                               UNIX_TIMESTAMP(cur_timestamp) as value
+                       FROM $cur $use_index
+                       WHERE cur_namespace=0 AND cur_is_redirect=0";
+       }
+       
+       function sortDescending() {
+               return false;
        }
 
        function formatResult( $skin, $result ) {
                global $wgLang;
 
-               $d = $wgLang->timeanddate( $result->cur_timestamp, true );
-               $link = $skin->makeKnownLink( $result->cur_title, "" );
+               $d = $wgLang->timeanddate( wfUnix2Timestamp( $result->value ), true );
+               $link = $skin->makeKnownLink( $result->title, "" );
                return "{$link} ({$d})";
        }
 }