Merge "Suppress section edit links with action=render"
[lhc/web/wiklou.git] / includes / specialpage / ChangesListSpecialPage.php
index 4e2556c..14ac401 100644 (file)
  * @ingroup SpecialPage
  */
 abstract class ChangesListSpecialPage extends SpecialPage {
-       var $rcSubpage, $rcOptions; // @todo Rename these, make protected
-       protected $customFilters;
+       /** @var string */
+       protected $rcSubpage;
 
-       /**
-        * The feed format to output as (either 'rss' or 'atom'), or null if no
-        * feed output was requested
-        *
-        * @var string $feedFormat
-        */
-       protected $feedFormat;
+       /** @var FormOptions */
+       protected $rcOptions;
+
+       /** @var array */
+       protected $customFilters;
 
        /**
         * Main execution point
@@ -46,19 +44,13 @@ abstract class ChangesListSpecialPage extends SpecialPage {
         */
        public function execute( $subpage ) {
                $this->rcSubpage = $subpage;
-               $this->feedFormat = $this->including() ? null : $this->getRequest()->getVal( 'feed' );
-               if ( $this->feedFormat !== 'atom' && $this->feedFormat !== 'rss' ) {
-                       $this->feedFormat = null;
-               }
 
                $this->setHeaders();
                $this->outputHeader();
                $this->addModules();
 
+               $rows = $this->getRows();
                $opts = $this->getOptions();
-               // Fetch results, prepare a batch link existence check query
-               $conds = $this->buildMainQueryConds( $opts );
-               $rows = $this->doMainQuery( $conds, $opts );
                if ( $rows === false ) {
                        if ( !$this->including() ) {
                                $this->doHeader( $opts );
@@ -67,26 +59,31 @@ abstract class ChangesListSpecialPage extends SpecialPage {
                        return;
                }
 
-               if ( !$this->feedFormat ) {
-                       $batch = new LinkBatch;
-                       foreach ( $rows as $row ) {
-                               $batch->add( NS_USER, $row->rc_user_text );
-                               $batch->add( NS_USER_TALK, $row->rc_user_text );
-                               $batch->add( $row->rc_namespace, $row->rc_title );
-                       }
-                       $batch->execute();
-               }
-               if ( $this->feedFormat ) {
-                       list( $changesFeed, $formatter ) = $this->getFeedObject( $this->feedFormat );
-                       /** @var ChangesFeed $changesFeed */
-                       $changesFeed->execute( $formatter, $rows, $this->checkLastModified( $this->feedFormat ), $opts );
-               } else {
-                       $this->webOutput( $rows, $opts );
+               $batch = new LinkBatch;
+               foreach ( $rows as $row ) {
+                       $batch->add( NS_USER, $row->rc_user_text );
+                       $batch->add( NS_USER_TALK, $row->rc_user_text );
+                       $batch->add( $row->rc_namespace, $row->rc_title );
                }
+               $batch->execute();
+
+               $this->webOutput( $rows, $opts );
 
                $rows->free();
        }
 
+       /**
+        * Get the database result for this special page instance. Used by ApiFeedRecentChanges.
+        *
+        * @return bool|ResultWrapper Result or false
+        */
+       public function getRows() {
+               $opts = $this->getOptions();
+               $conds = $this->buildMainQueryConds( $opts );
+
+               return $this->doMainQuery( $conds, $opts );
+       }
+
        /**
         * Get the current FormOptions for this request
         *
@@ -168,6 +165,7 @@ abstract class ChangesListSpecialPage extends SpecialPage {
         */
        protected function fetchOptionsFromRequest( $opts ) {
                $opts->fetchValuesFromRequest( $this->getRequest() );
+
                return $opts;
        }
 
@@ -297,6 +295,7 @@ abstract class ChangesListSpecialPage extends SpecialPage {
                // }
 
                $dbr = $this->getDB();
+
                return $dbr->select(
                        $tables,
                        $fields,
@@ -461,30 +460,6 @@ abstract class ChangesListSpecialPage extends SpecialPage {
                $out->addModules( 'mediawiki.special.changeslist.legend.js' );
        }
 
-       /**
-        * Return an array with a ChangesFeed object and ChannelFeed object.
-        *
-        * This is intentionally not abstract not to require subclasses which don't
-        * use feeds functionality to implement it.
-        *
-        * @param string $feedFormat Feed's format (either 'rss' or 'atom')
-        * @return array
-        */
-       public function getFeedObject( $feedFormat ) {
-               throw new MWException( "Not implemented" );
-       }
-
-       /**
-        * Get last-modified date, for client caching. Not implemented by default
-        * (returns current time).
-        *
-        * @param string $feedFormat
-        * @return string|bool
-        */
-       public function checkLastModified( $feedFormat ) {
-               return wfTimestampNow();
-       }
-
        protected function getGroupName() {
                return 'changes';
        }