/**
* Query module to enumerate all available pages.
*
- * @addtogroup API
+ * @ingroup API
*/
class ApiQueryAllpages extends ApiQueryGeneratorBase {
$params = $this->extractRequestParams();
// Page filters
+ $this->addTables('page');
if (!$this->addWhereIf('page_is_redirect = 1', $params['filterredir'] === 'redirects'))
$this->addWhereIf('page_is_redirect = 0', $params['filterredir'] === 'nonredirects');
$this->addWhereFld('page_namespace', $params['namespace']);
$dir = ($params['dir'] == 'descending' ? 'older' : 'newer');
- $from = (is_null($params['from']) ? null : ApiQueryBase::titleToKey($params['from']));
+ $from = (is_null($params['from']) ? null : $this->titleToKey($params['from']));
$this->addWhereRange('page_title', $dir, $from, null);
if (isset ($params['prefix']))
- $this->addWhere("page_title LIKE '" . $db->escapeLike(ApiQueryBase :: titleToKey($params['prefix'])) . "%'");
+ $this->addWhere("page_title LIKE '" . $db->escapeLike($this->titleToKey($params['prefix'])) . "%'");
$forceNameTitleIndex = true;
if (isset ($params['minsize'])) {
}
if($params['filterlanglinks'] == 'withoutlanglinks') {
- $pageName = $this->getDB()->tableName('page');
- $llName = $this->getDB()->tableName('langlinks');
- $tables = "$pageName LEFT JOIN $llName ON page_id=ll_from";
+ $this->addTables('langlinks');
+ $this->addJoinConds(array('langlinks' => array('LEFT JOIN', 'page_id=ll_from')));
$this->addWhere('ll_from IS NULL');
- $this->addTables($tables);
$forceNameTitleIndex = false;
} else if($params['filterlanglinks'] == 'withlanglinks') {
- $this->addTables(array('page', 'langlinks'));
+ $this->addTables('langlinks');
$this->addWhere('page_id=ll_from');
$forceNameTitleIndex = false;
- } else {
- $this->addTables('page');
}
if ($forceNameTitleIndex)
$this->addOption('USE INDEX', 'name_title');
if (++ $count > $limit) {
// We've reached the one extra which shows that there are additional pages to be had. Stop here...
// TODO: Security issue - if the user has no right to view next title, it will still be shown
- $this->setContinueEnumParameter('from', ApiQueryBase :: keyToTitle($row->page_title));
+ $this->setContinueEnumParameter('from', $this->keyToTitle($row->page_title));
break;
}