X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecialpage%2FChangesListSpecialPage.php;h=14ac401d2a527a110f80a9aaae3aba711156697b;hb=2e09c356789bf7569fdfa219827f488976aa16f0;hp=4e2556ccf68050c8eca0eb10e10f30ac0f3de872;hpb=0f0b88c5b38b515c3beca380b5eb8a55cf96ea3b;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specialpage/ChangesListSpecialPage.php b/includes/specialpage/ChangesListSpecialPage.php index 4e2556ccf6..14ac401d2a 100644 --- a/includes/specialpage/ChangesListSpecialPage.php +++ b/includes/specialpage/ChangesListSpecialPage.php @@ -28,16 +28,14 @@ * @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'; }