I had a fix for this bug sitting in my working copy for over a week without getting...
[lhc/web/wiklou.git] / includes / SpecialAncientpages.php
index aadf79b..91bd543 100644 (file)
@@ -1,7 +1,20 @@
-<?
-
-include_once( "QueryPage.php" );
-
+<?php
+/**
+ *
+ * @package MediaWiki
+ * @subpackage SpecialPage
+ */
+
+/**
+ *
+ */
+require_once( 'QueryPage.php' );
+
+/**
+ *
+ * @package MediaWiki
+ * @subpackage SpecialPage
+ */
 class AncientPagesPage extends QueryPage {
 
        function getName() {
@@ -12,24 +25,33 @@ 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,
+                               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( wfTimestamp( $result->value ), true );
+               $link = $skin->makeKnownLink( $result->title, "" );
                return "{$link} ({$d})";
        }
 }
 
-function wfSpecialAncientpages()
-{
+function wfSpecialAncientpages() {
        list( $limit, $offset ) = wfCheckLimits();
 
        $app = new AncientPagesPage();