-<?
+<?php
-function wfSpecialAncientpages()
-{
- global $wgUser, $wgOut, $wgLang, $wgTitle;
- global $limit, $offset; # From query string
- $fname = "wfSpecialAncientpages";
+require_once( "QueryPage.php" );
+
+class AncientPagesPage extends QueryPage {
+
+ function getName() {
+ return "Ancientpages";
+ }
+
+ function isExpensive() {
+ return parent::isExpensive() ;
+ }
- if ( ! $limit ) {
- $limit = $wgUser->getOption( "rclimit" );
- if ( ! $limit ) { $limit = 50; }
+ function getSQL() {
+ global $wgIsMySQL;
+ $use_index=$wgIsMySQL?"USE INDEX (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;
}
- if ( ! $offset ) { $offset = 0; }
-
- $sql = "SELECT cur_title,cur_user,cur_user_text,cur_comment," .
- "cur_timestamp FROM cur USE INDEX (namespace_redirect_timestamp) " .
- "WHERE cur_namespace=0 AND cur_is_redirect=0 " .
- " ORDER BY cur_timestamp LIMIT {$offset}, {$limit}";
- $res = wfQuery( $sql, $fname );
-
- $top = wfShowingResults( $offset, $limit );
- $wgOut->addHTML( "<p>{$top}\n" );
-
- $sl = wfViewPrevNext( $offset, $limit,
- $wgLang->specialPage( "Ancientpages" ) );
- $wgOut->addHTML( "<br>{$sl}\n" );
-
- $sk = $wgUser->getSkin();
- $s = "<ol start=" . ( $offset + 1 ) . ">";
- while ( $obj = wfFetchObject( $res ) ) {
- $u = $obj->cur_user;
- $ut = $obj->cur_user_text;
- $c = wfEscapeHTML( $obj->cur_comment );
- if ( 0 == $u ) { $ul = $ut; }
- else { $ul = $sk->makeLink( $wgLang->getNsText(2).":{$ut}", $ut ); }
-
- $d = $wgLang->timeanddate( $obj->cur_timestamp, true );
- $link = $sk->makeKnownLink( $obj->cur_title, "" );
- $s .= "<li>{$d} {$link} . . {$ul}";
-
- if ( "" != $c && "*" != $c ) { $s .= " <em>({$c})</em>"; }
- $s .= "</li>\n";
+
+ function formatResult( $skin, $result ) {
+ global $wgLang;
+
+ $d = $wgLang->timeanddate( wfUnix2Timestamp( $result->value ), true );
+ $link = $skin->makeKnownLink( $result->title, "" );
+ return "{$link} ({$d})";
}
- wfFreeResult( $res );
- $s .= "</ol>";
- $wgOut->addHTML( $s );
- $wgOut->addHTML( "<p>{$sl}\n" );
+}
+
+function wfSpecialAncientpages()
+{
+ list( $limit, $offset ) = wfCheckLimits();
+
+ $app = new AncientPagesPage();
+
+ $app->doQuery( $offset, $limit );
}
?>