]> scripts.mit.edu Git - autoinstallsdev/mediawiki.git/blobdiff - includes/specials/SpecialAncientpages.php
MediaWiki 1.30.2
[autoinstallsdev/mediawiki.git] / includes / specials / SpecialAncientpages.php
index 2d5047d2d23adcb664c50f94e1cbe0affa90856b..ecc030e6387c2da4fb7cca70850f879c070391d1 100644 (file)
  */
 class AncientPagesPage extends QueryPage {
 
-       function getName() {
-               return "Ancientpages";
+       function __construct( $name = 'Ancientpages' ) {
+               parent::__construct( $name );
        }
 
-       function isExpensive() {
+       public function isExpensive() {
                return true;
        }
 
-       function isSyndicated() { return false; }
+       function isSyndicated() {
+               return false;
+       }
 
-       function getSQL() {
-               $db = wfGetDB( DB_SLAVE );
-               $page = $db->tableName( 'page' );
-               $revision = $db->tableName( 'revision' );
-               $epoch = $db->unixTimestamp( 'rev_timestamp' );
+       public function getQueryInfo() {
+               return [
+                       'tables' => [ 'page', 'revision' ],
+                       'fields' => [
+                               'namespace' => 'page_namespace',
+                               'title' => 'page_title',
+                               'value' => 'rev_timestamp'
+                       ],
+                       'conds' => [
+                               'page_namespace' => MWNamespace::getContentNamespaces(),
+                               'page_is_redirect' => 0,
+                               'page_latest=rev_id'
+                       ]
+               ];
+       }
 
-               return
-                       "SELECT 'Ancientpages' as type,
-                                       page_namespace as namespace,
-                               page_title as title,
-                               $epoch as value
-                       FROM $page, $revision
-                       WHERE page_namespace=".NS_MAIN." AND page_is_redirect=0
-                         AND page_latest=rev_id";
+       public function usesTimestamps() {
+               return true;
        }
 
        function sortDescending() {
                return false;
        }
 
+       public function preprocessResults( $db, $res ) {
+               $this->executeLBFromResultWrapper( $res );
+       }
+
+       /**
+        * @param Skin $skin
+        * @param object $result Result row
+        * @return string
+        */
        function formatResult( $skin, $result ) {
-               global $wgLang, $wgContLang;
+               global $wgContLang;
 
-               $d = $wgLang->timeanddate( wfTimestamp( TS_MW, $result->value ), true );
+               $d = $this->getLanguage()->userTimeAndDate( $result->value, $this->getUser() );
                $title = Title::makeTitle( $result->namespace, $result->title );
-               $link = $skin->linkKnown(
+               $linkRenderer = $this->getLinkRenderer();
+               $link = $linkRenderer->makeKnownLink(
                        $title,
-                       htmlspecialchars( $wgContLang->convert( $title->getPrefixedText() ) )
+                       $wgContLang->convert( $title->getPrefixedText() )
                );
-               return wfSpecialList($link, htmlspecialchars($d) );
-       }
-}
-
-function wfSpecialAncientpages() {
-       list( $limit, $offset ) = wfCheckLimits();
 
-       $app = new AncientPagesPage();
+               return $this->getLanguage()->specialList( $link, htmlspecialchars( $d ) );
+       }
 
-       $app->doQuery( $offset, $limit );
+       protected function getGroupName() {
+               return 'maintenance';
+       }
 }