* @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
*/
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 );
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
*
*/
protected function fetchOptionsFromRequest( $opts ) {
$opts->fetchValuesFromRequest( $this->getRequest() );
+
return $opts;
}
// }
$dbr = $this->getDB();
+
return $dbr->select(
$tables,
$fields,
$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';
}