var $ids, $res, $current;
- function __construct( RequestContext $context, Title $title, array $ids ) {
+ /**
+ * Construct a revision list for a given title
+ * @param $context RequestContext
+ * @param $title Title
+ */
+ function __construct( RequestContext $context, Title $title ) {
$this->context = $context;
$this->title = $title;
+ }
+
+ /**
+ * Select items only where the ID is any of the specified values
+ * @param $ids Array
+ */
+ function filterByIds( array $ids ) {
$this->ids = $ids;
}
* @return mixed
*/
public function doQuery( $db ) {
- $ids = array_map( 'intval', $this->ids );
- return $db->select( array('revision','page'), '*',
- array(
- 'rev_page' => $this->title->getArticleID(),
- 'rev_id' => array_map( 'intval', $this->ids ),
- 'rev_page = page_id'
- ),
+ $conds = array(
+ 'rev_page' => $this->title->getArticleID(),
+ 'rev_page = page_id'
+ );
+ if ( $this->ids !== null ) {
+ $conds['rev_id'] = array_map( 'intval', $this->ids );
+ }
+ return $db->select(
+ array( 'revision', 'page' ),
+ '*',
+ $conds,
__METHOD__,
array( 'ORDER BY' => 'rev_id DESC' )
);
* to wrap bulk update operations.
*/
abstract class RevDel_List extends Rev_List {
+ function __construct( RequestContext $context, Title $title, array $ids ) {
+ parent::__construct( $context, $title );
+ $this->ids = $ids;
+ }
+
/**
* Get the DB field name associated with the ID list.
* This used to populate the log_search table for finding log entries.