Fix epic fail in r64860
[lhc/web/wiklou.git] / includes / specials / SpecialAncientpages.php
index 6ebd570..9219243 100644 (file)
@@ -25,8 +25,25 @@ class AncientPagesPage extends QueryPage {
                $db = wfGetDB( DB_SLAVE );
                $page = $db->tableName( 'page' );
                $revision = $db->tableName( 'revision' );
-               $epoch = $wgDBtype == 'mysql' ? 'UNIX_TIMESTAMP(rev_timestamp)' :
-                       'EXTRACT(epoch FROM rev_timestamp)';
+
+               switch ($wgDBtype) {
+                       case 'mysql': 
+                               $epoch = 'UNIX_TIMESTAMP(rev_timestamp)'; 
+                               break;
+                       case 'ibm_db2':
+                               // TODO implement proper conversion to a Unix epoch
+                               $epoch = 'rev_timestamp';
+                               break;
+                       case 'oracle': 
+                               $epoch = '((trunc(rev_timestamp) - to_date(\'19700101\',\'YYYYMMDD\')) * 86400)'; 
+                               break;
+                       case 'sqlite':
+                               $epoch = 'rev_timestamp';
+                               break;
+                       default:
+                               $epoch = 'EXTRACT(epoch FROM rev_timestamp)';
+               }
+
                return
                        "SELECT 'Ancientpages' as type,
                                        page_namespace as namespace,
@@ -46,7 +63,10 @@ class AncientPagesPage extends QueryPage {
 
                $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() ) ) );
+               $link = $skin->linkKnown(
+                       $title,
+                       htmlspecialchars( $wgContLang->convert( $title->getPrefixedText() ) )
+               );
                return wfSpecialList($link, htmlspecialchars($d) );
        }
 }