}
public function execute() {
- $limit = $startid = $endid = $start = $end = $dir = $prop = $user = $excludeuser = $expandtemplates = $generatexml = $section = $token = null;
- extract($this->extractRequestParams(false));
+ $params = $this->extractRequestParams(false);
// If any of those parameters are used, work in 'enumeration' mode.
// Enum mode can only be used when exactly one page is provided.
// Enumerating revisions on multiple pages make it extremely
// difficult to manage continuations and require additional SQL indexes
- $enumRevMode = (!is_null($user) || !is_null($excludeuser) || !is_null($limit) || !is_null($startid) || !is_null($endid) || $dir === 'newer' || !is_null($start) || !is_null($end));
+ $enumRevMode = (!is_null($params['user']) || !is_null($params['excludeuser']) ||
+ !is_null($params['limit']) || !is_null($params['startid']) ||
+ !is_null($params['endid']) || $params['dir'] === 'newer' ||
+ !is_null($params['start']) || !is_null($params['end']));
$pageSet = $this->getPageSet();
$this->addTables( 'page' );
$this->addWhere('page_id = rev_page');
- $prop = array_flip($prop);
+ $prop = array_flip($params['prop']);
// Optional fields
$this->fld_ids = isset ($prop['ids']);
$this->fld_comment = isset ($prop['comment']);
$this->fld_size = isset ($prop['size']);
$this->fld_user = isset ($prop['user']);
- $this->token = $token;
+ $this->token = $params['token'];
if ( !is_null($this->token) || $pageCount > 0) {
$this->addFields( Revision::selectPageFields() );
$this->fld_content = true;
- $this->expandTemplates = $expandtemplates;
- $this->generateXML = $generatexml;
- if(isset($section))
- $this->section = $section;
+ $this->expandTemplates = $params['expandtemplates'];
+ $this->generateXML = $params['generatexml'];
+ if(isset($params['section']))
+ $this->section = $params['section'];
else
$this->section = false;
}
$userMax = ( $this->fld_content ? ApiBase::LIMIT_SML1 : ApiBase::LIMIT_BIG1 );
$botMax = ( $this->fld_content ? ApiBase::LIMIT_SML2 : ApiBase::LIMIT_BIG2 );
+ $limit = $params['limit'];
if( $limit == 'max' ) {
$limit = $this->getMain()->canApiHighLimits() ? $botMax : $userMax;
$this->getResult()->addValue( 'limits', $this->getModuleName(), $limit );
if ($enumRevMode) {
// This is mostly to prevent parameter errors (and optimize SQL?)
- if (!is_null($startid) && !is_null($start))
+ if (!is_null($params['startid']) && !is_null($params['start']))
$this->dieUsage('start and startid cannot be used together', 'badparams');
- if (!is_null($endid) && !is_null($end))
+ if (!is_null($params['endid']) && !is_null($params['end']))
$this->dieUsage('end and endid cannot be used together', 'badparams');
- if(!is_null($user) && !is_null( $excludeuser))
+ if(!is_null($params['user']) && !is_null($params['excludeuser']))
$this->dieUsage('user and excludeuser cannot be used together', 'badparams');
// This code makes an assumption that sorting by rev_id and rev_timestamp produces
// one row with the same timestamp for the same page.
// The order needs to be the same as start parameter to avoid SQL filesort.
- if (is_null($startid) && is_null($endid))
- $this->addWhereRange('rev_timestamp', $dir, $start, $end);
+ if (is_null($params['startid']) && is_null($params['endid']))
+ $this->addWhereRange('rev_timestamp', $params['dir'],
+ $params['start'], $params['end']);
else
- $this->addWhereRange('rev_id', $dir, $startid, $endid);
+ $this->addWhereRange('rev_id', $params['dir'],
+ $params['startid'], $params['endid']);
// must manually initialize unset limit
if (is_null($limit))
// There is only one ID, use it
$this->addWhereFld('rev_page', current(array_keys($pageSet->getGoodTitles())));
- if(!is_null($user)) {
- $this->addWhereFld('rev_user_text', $user);
- } elseif (!is_null( $excludeuser)) {
- $this->addWhere('rev_user_text != ' . $this->getDB()->addQuotes($excludeuser));
+ if(!is_null($params['user'])) {
+ $this->addWhereFld('rev_user_text', $params['user']);
+ } elseif (!is_null( $params['excludeuser'])) {
+ $this->addWhere('rev_user_text != ' .
+ $this->getDB()->addQuotes($params['excludeuser']));
}
}
elseif ($revCount > 0) {