2004-02-18 02:15:00 +00:00
|
|
|
<?php
|
2004-09-02 23:28:24 +00:00
|
|
|
/**
|
|
|
|
|
*
|
2004-09-03 23:00:01 +00:00
|
|
|
* @package MediaWiki
|
|
|
|
|
* @subpackage SpecialPage
|
2004-09-02 23:28:24 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
require_once( 'QueryPage.php' );
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*
|
2004-09-03 23:00:01 +00:00
|
|
|
* @package MediaWiki
|
|
|
|
|
* @subpackage SpecialPage
|
2004-09-02 23:28:24 +00:00
|
|
|
*/
|
I was adding a special page (dead-end pages), and I realized that almost all
the special query pages were pretty much identical. I copy-and-pasted one to
make the one I was working on, and I realized that that was Wrong.
So, I took the common elements and made them into a class, QueryPage.php.
Then, I derived each of the existing special pages from QueryPage, and
overrode places where they differed. This is a Recipe pattern, btw, for
those of you following along at home.
Anyways, the upshot is that the query pages are a lot shorter, with just the
essentials that make them different from other query pages, and there's one
place to make big UI changes for all queries.
2003-12-01 16:04:35 +00:00
|
|
|
class AncientPagesPage extends QueryPage {
|
2003-05-20 00:53:04 +00:00
|
|
|
|
2004-01-25 02:27:49 +00:00
|
|
|
function getName() {
|
|
|
|
|
return "Ancientpages";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function isExpensive() {
|
|
|
|
|
return parent::isExpensive() ;
|
|
|
|
|
}
|
|
|
|
|
|
2004-05-09 01:30:34 +00:00
|
|
|
function getSQL() {
|
2004-07-18 08:48:43 +00:00
|
|
|
$db =& wfGetDB( DB_SLAVE );
|
|
|
|
|
$cur = $db->tableName( 'cur' );
|
2004-07-10 03:09:26 +00:00
|
|
|
$use_index = $db->useIndexClause( 'cur_timestamp' );
|
2004-05-09 01:30:34 +00:00
|
|
|
return
|
|
|
|
|
"SELECT 'Ancientpages' as type,
|
|
|
|
|
cur_namespace as namespace,
|
|
|
|
|
cur_title as title,
|
2004-09-09 11:53:14 +00:00
|
|
|
cur_timestamp as value
|
2004-07-18 08:48:43 +00:00
|
|
|
FROM $cur $use_index
|
2004-05-09 01:30:34 +00:00
|
|
|
WHERE cur_namespace=0 AND cur_is_redirect=0";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function sortDescending() {
|
|
|
|
|
return false;
|
2004-01-25 02:27:49 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function formatResult( $skin, $result ) {
|
2004-10-21 03:36:19 +00:00
|
|
|
global $wgLang, $wgContLang;
|
2004-01-25 02:27:49 +00:00
|
|
|
|
2004-10-03 10:50:34 +00:00
|
|
|
$d = $wgLang->timeanddate( wfTimestamp( TS_MW, $result->value ), true );
|
2004-10-21 03:36:19 +00:00
|
|
|
$link = $skin->makeKnownLink( $result->title, $wgContLang->convert( $result->title) );
|
2004-01-25 02:27:49 +00:00
|
|
|
return "{$link} ({$d})";
|
|
|
|
|
}
|
I was adding a special page (dead-end pages), and I realized that almost all
the special query pages were pretty much identical. I copy-and-pasted one to
make the one I was working on, and I realized that that was Wrong.
So, I took the common elements and made them into a class, QueryPage.php.
Then, I derived each of the existing special pages from QueryPage, and
overrode places where they differed. This is a Recipe pattern, btw, for
those of you following along at home.
Anyways, the upshot is that the query pages are a lot shorter, with just the
essentials that make them different from other query pages, and there's one
place to make big UI changes for all queries.
2003-12-01 16:04:35 +00:00
|
|
|
}
|
2003-05-20 00:53:04 +00:00
|
|
|
|
2004-09-02 23:28:24 +00:00
|
|
|
function wfSpecialAncientpages() {
|
2004-01-25 02:27:49 +00:00
|
|
|
list( $limit, $offset ) = wfCheckLimits();
|
|
|
|
|
|
|
|
|
|
$app = new AncientPagesPage();
|
|
|
|
|
|
|
|
|
|
$app->doQuery( $offset, $limit );
|
2003-05-20 00:53:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
?>
|