initialize array before preg_match*
[lhc/web/wiklou.git] / includes / SpecialAncientpages.php
index 13c97b4..1de0e05 100644 (file)
@@ -1,7 +1,20 @@
 <?php
+/**
+ *
+ * @package MediaWiki
+ * @subpackage SpecialPage
+ */
 
-include_once( "QueryPage.php" );
+/**
+ *
+ */
+require_once( 'QueryPage.php' );
 
+/**
+ *
+ * @package MediaWiki
+ * @subpackage SpecialPage
+ */
 class AncientPagesPage extends QueryPage {
 
        function getName() {
@@ -9,27 +22,41 @@ class AncientPagesPage extends QueryPage {
        }
 
        function isExpensive() {
-               return parent::isExpensive() ;
+               return true;
        }
+       
+       function isSyndicated() { return false; }
 
-       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 );
+               $page = $db->tableName( 'page' );
+               $revision = $db->tableName( 'revision' );
+               #$use_index = $db->useIndexClause( 'cur_timestamp' ); # FIXME! this is gone
+               return
+                       "SELECT 'Ancientpages' as type,
+                                       page_namespace as namespace,
+                               page_title as title,
+                               UNIX_TIMESTAMP(rev_timestamp) 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( $result->cur_timestamp, true );
-               $link = $skin->makeKnownLink( $result->cur_title, "" );
+               $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 "{$link} ({$d})";
        }
 }
 
-function wfSpecialAncientpages()
-{
+function wfSpecialAncientpages() {
        list( $limit, $offset ) = wfCheckLimits();
 
        $app = new AncientPagesPage();