specialpage: Remove unused QueryPage::doFeed()
authorThiemo Kreuz <thiemo.kreuz@wikimedia.de>
Mon, 25 Mar 2019 08:17:06 +0000 (09:17 +0100)
committerThiemo Kreuz <thiemo.kreuz@wikimedia.de>
Mon, 25 Mar 2019 08:42:48 +0000 (09:42 +0100)
This code was written in 2004, and pretty much untouched since then.

The last non-trivial update to this code was done in 2014 via I1de6301.
But as far as I can tell this was just maintenance, not motivated by
somebody actually using this code.

I suspect this is unused for a long time already, long before 2014.
Possibly even unused in 2004. Really: I tried to dig into the revision
history of the core codebase to find when and where this was used, and
when it became unused. I could not find anything. I also used
https://codesearch.wmflabs.org to make sure there are no known callers
or subclasses hidden anywhere. I could not find anything either.

In conclusion I suggest to skip any deprecation phase.

Change-Id: I5f52c44760b903bcb348bebf8c6a0f6faf8180b7

includes/specialpage/QueryPage.php

index 579ca19..2c954e8 100644 (file)
@@ -754,98 +754,6 @@ abstract class QueryPage extends SpecialPage {
        function preprocessResults( $db, $res ) {
        }
 
-       /**
-        * Similar to above, but packaging in a syndicated feed instead of a web page
-        * @param string $class
-        * @param int $limit
-        * @return bool
-        */
-       function doFeed( $class = '', $limit = 50 ) {
-               if ( !$this->getConfig()->get( 'Feed' ) ) {
-                       $this->getOutput()->addWikiMsg( 'feed-unavailable' );
-                       return false;
-               }
-
-               $limit = min( $limit, $this->getConfig()->get( 'FeedLimit' ) );
-
-               $feedClasses = $this->getConfig()->get( 'FeedClasses' );
-               if ( isset( $feedClasses[$class] ) ) {
-                       /** @var RSSFeed|AtomFeed $feed */
-                       $feed = new $feedClasses[$class](
-                               $this->feedTitle(),
-                               $this->feedDesc(),
-                               $this->feedUrl() );
-                       $feed->outHeader();
-
-                       $res = $this->reallyDoQuery( $limit, 0 );
-                       foreach ( $res as $obj ) {
-                               $item = $this->feedResult( $obj );
-                               if ( $item ) {
-                                       $feed->outItem( $item );
-                               }
-                       }
-
-                       $feed->outFooter();
-                       return true;
-               } else {
-                       return false;
-               }
-       }
-
-       /**
-        * Override for custom handling. If the titles/links are ok, just do
-        * feedItemDesc()
-        * @param object $row
-        * @return FeedItem|null
-        */
-       function feedResult( $row ) {
-               if ( !isset( $row->title ) ) {
-                       return null;
-               }
-               $title = Title::makeTitle( intval( $row->namespace ), $row->title );
-               if ( $title ) {
-                       $date = $row->timestamp ?? '';
-                       $comments = '';
-                       if ( $title ) {
-                               $talkpage = $title->getTalkPage();
-                               $comments = $talkpage->getFullURL();
-                       }
-
-                       return new FeedItem(
-                               $title->getPrefixedText(),
-                               $this->feedItemDesc( $row ),
-                               $title->getFullURL(),
-                               $date,
-                               $this->feedItemAuthor( $row ),
-                               $comments );
-               } else {
-                       return null;
-               }
-       }
-
-       function feedItemDesc( $row ) {
-               return isset( $row->comment ) ? htmlspecialchars( $row->comment ) : '';
-       }
-
-       function feedItemAuthor( $row ) {
-               return $row->user_text ?? '';
-       }
-
-       function feedTitle() {
-               $desc = $this->getDescription();
-               $code = $this->getConfig()->get( 'LanguageCode' );
-               $sitename = $this->getConfig()->get( 'Sitename' );
-               return "$sitename - $desc [$code]";
-       }
-
-       function feedDesc() {
-               return $this->msg( 'tagline' )->text();
-       }
-
-       function feedUrl() {
-               return $this->getPageTitle()->getFullURL();
-       }
-
        /**
         * Creates a new LinkBatch object, adds all pages from the passed ResultWrapper (MUST include
         * title and optional the namespace field) and executes the batch. This operation will pre-cache