SpecialAncientpages.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php
  2. /**
  3. * @file
  4. * @ingroup SpecialPage
  5. */
  6. /**
  7. * Implements Special:Ancientpages
  8. * @ingroup SpecialPage
  9. */
  10. class AncientPagesPage extends QueryPage {
  11. function getName() {
  12. return "Ancientpages";
  13. }
  14. function isExpensive() {
  15. return true;
  16. }
  17. function isSyndicated() { return false; }
  18. function getSQL() {
  19. global $wgDBtype;
  20. $db = wfGetDB( DB_SLAVE );
  21. $page = $db->tableName( 'page' );
  22. $revision = $db->tableName( 'revision' );
  23. $epoch = $wgDBtype == 'mysql' ? 'UNIX_TIMESTAMP(rev_timestamp)' :
  24. 'EXTRACT(epoch FROM rev_timestamp)';
  25. return
  26. "SELECT 'Ancientpages' as type,
  27. page_namespace as namespace,
  28. page_title as title,
  29. $epoch as value
  30. FROM $page, $revision
  31. WHERE page_namespace=".NS_MAIN." AND page_is_redirect=0
  32. AND page_latest=rev_id";
  33. }
  34. function sortDescending() {
  35. return false;
  36. }
  37. function formatResult( $skin, $result ) {
  38. global $wgLang, $wgContLang;
  39. $d = $wgLang->timeanddate( wfTimestamp( TS_MW, $result->value ), true );
  40. $title = Title::makeTitle( $result->namespace, $result->title );
  41. $link = $skin->makeKnownLinkObj( $title, htmlspecialchars( $wgContLang->convert( $title->getPrefixedText() ) ) );
  42. return wfSpecialList($link, $d);
  43. }
  44. }
  45. function wfSpecialAncientpages() {
  46. list( $limit, $offset ) = wfCheckLimits();
  47. $app = new AncientPagesPage();
  48. $app->doQuery( $offset, $limit );
  49. }