* Friendlier check for PHP 5 in command-line scripts; it's common for parallel
[mediawiki.git] / includes / SpecialAncientpages.php
blob39a3c8ea17cacd7886e5fe18314670ebc18e7256
1 <?php
2 /**
4 * @package MediaWiki
5 * @subpackage SpecialPage
6 */
8 /**
10 * @package MediaWiki
11 * @subpackage SpecialPage
13 class AncientPagesPage extends QueryPage {
15 function getName() {
16 return "Ancientpages";
19 function isExpensive() {
20 return true;
23 function isSyndicated() { return false; }
25 function getSQL() {
26 global $wgDBtype;
27 $db =& wfGetDB( DB_SLAVE );
28 $page = $db->tableName( 'page' );
29 $revision = $db->tableName( 'revision' );
30 #$use_index = $db->useIndexClause( 'cur_timestamp' ); # FIXME! this is gone
31 $epoch = $wgDBtype == 'mysql' ? 'UNIX_TIMESTAMP(rev_timestamp)' :
32 'EXTRACT(epoch FROM rev_timestamp)';
33 return
34 "SELECT 'Ancientpages' as type,
35 page_namespace as namespace,
36 page_title as title,
37 $epoch as value
38 FROM $page, $revision
39 WHERE page_namespace=".NS_MAIN." AND page_is_redirect=0
40 AND page_latest=rev_id";
43 function sortDescending() {
44 return false;
47 function formatResult( $skin, $result ) {
48 global $wgLang, $wgContLang;
50 $d = $wgLang->timeanddate( wfTimestamp( TS_MW, $result->value ), true );
51 $title = Title::makeTitle( $result->namespace, $result->title );
52 $link = $skin->makeKnownLinkObj( $title, htmlspecialchars( $wgContLang->convert( $title->getPrefixedText() ) ) );
53 return wfSpecialList($link, $d);
57 function wfSpecialAncientpages() {
58 list( $limit, $offset ) = wfCheckLimits();
60 $app = new AncientPagesPage();
62 $app->doQuery( $offset, $limit );