Revert r28215: incorrectly moved files
[lhc/web/wiklou.git] / includes / SpecialAncientpages.php
index 52bc005..dee8fbd 100644 (file)
@@ -1,7 +1,13 @@
 <?php
-
-require_once( "QueryPage.php" );
-
+/**
+ *
+ * @addtogroup SpecialPage
+ */
+
+/**
+ * Implements Special:Ancientpages
+ * @addtogroup SpecialPage
+ */
 class AncientPagesPage extends QueryPage {
 
        function getName() {
@@ -9,34 +15,44 @@ class AncientPagesPage extends QueryPage {
        }
 
        function isExpensive() {
-               return parent::isExpensive() ;
+               return true;
        }
 
+       function isSyndicated() { return false; }
+
        function getSQL() {
+               global $wgDBtype;
+               $db = wfGetDB( DB_SLAVE );
+               $page = $db->tableName( 'page' );
+               $revision = $db->tableName( 'revision' );
+               #$use_index = $db->useIndexClause( 'cur_timestamp' ); # FIXME! this is gone
+               $epoch = $wgDBtype == 'mysql' ? 'UNIX_TIMESTAMP(rev_timestamp)' :
+                       'EXTRACT(epoch FROM rev_timestamp)';
                return
                        "SELECT 'Ancientpages' as type,
-                                       cur_namespace as namespace,
-                               cur_title as title,
-                               UNIX_TIMESTAMP(cur_timestamp) as value
-                       FROM cur USE INDEX (cur_timestamp)
-                       WHERE cur_namespace=0 AND cur_is_redirect=0";
+                                       page_namespace as namespace,
+                               page_title as title,
+                               $epoch as value
+                       FROM $page, $revision
+                       WHERE page_namespace=".NS_MAIN." AND page_is_redirect=0
+                         AND page_latest=rev_id";
        }
-       
+
        function sortDescending() {
                return false;
        }
 
        function formatResult( $skin, $result ) {
-               global $wgLang;
+               global $wgLang, $wgContLang;
 
-               $d = $wgLang->timeanddate( wfUnix2Timestamp( $result->value ), true );
-               $link = $skin->makeKnownLink( $result->title, "" );
-               return "{$link} ({$d})";
+               $d = $wgLang->timeanddate( wfTimestamp( TS_MW, $result->value ), true );
+               $title = Title::makeTitle( $result->namespace, $result->title );
+               $link = $skin->makeKnownLinkObj( $title, htmlspecialchars( $wgContLang->convert( $title->getPrefixedText() ) ) );
+               return wfSpecialList($link, $d);
        }
 }
 
-function wfSpecialAncientpages()
-{
+function wfSpecialAncientpages() {
        list( $limit, $offset ) = wfCheckLimits();
 
        $app = new AncientPagesPage();
@@ -44,4 +60,4 @@ function wfSpecialAncientpages()
        $app->doQuery( $offset, $limit );
 }
 
-?>
+