$params = $this->extractRequestParams();
$prop = $params['prop'];
+ $show = array_flip((array)$params['show']);
$this->addFields(array (
'cl_from',
$this->dieUsage("Invalid continue param. You should pass the " .
"original value returned by the previous query", "_badcontinue");
$clfrom = intval($cont[0]);
- $clto = $this->getDb()->strencode($cont[1]);
+ $clto = $this->getDB()->strencode($this->titleToKey($cont[1]));
$this->addWhere("cl_from > $clfrom OR ".
"(cl_from = $clfrom AND ".
"cl_to >= '$clto')");
}
+ if(isset($show['hidden']) && isset($show['!hidden']))
+ $this->dieUsage("Incorrect parameter - mutually exclusive values may not be supplied", 'show');
+ if(isset($show['hidden']) || isset($show['!hidden']))
+ {
+ $this->addOption('STRAIGHT_JOIN');
+ $this->addTables(array('page', 'page_props'));
+ $this->addJoinConds(array(
+ 'page' => array('LEFT JOIN', array(
+ 'page_namespace' => NS_CATEGORY,
+ 'page_title = cl_to')),
+ 'page_props' => array('LEFT JOIN', array(
+ 'pp_page=page_id',
+ 'pp_propname' => 'hiddencat'))
+ ));
+ if(isset($show['hidden']))
+ $this->addWhere(array('pp_propname IS NOT NULL'));
+ else
+ $this->addWhere(array('pp_propname IS NULL'));
+ }
+
# Don't order by cl_from if it's constant in the WHERE clause
if(count($this->getPageSet()->getGoodTitles()) == 1)
$this->addOption('ORDER BY', 'cl_to');
if (++$count > $params['limit']) {
// We've reached the one extra which shows that
// there are additional pages to be had. Stop here...
- $this->setContinueEnumParameter('continue', "{$row->cl_from}|{$row->cl_to}");
+ $this->setContinueEnumParameter('continue', $row->cl_from .
+ '|' . $this->keyToTitle($row->cl_to));
break;
}
if ($lastId != $row->cl_from) {
if ($fld_sortkey)
$vals['sortkey'] = $row->cl_sortkey;
if ($fld_timestamp)
- $vals['timestamp'] = $row->cl_timestamp;
+ $vals['timestamp'] = wfTimestamp(TS_ISO_8601, $row->cl_timestamp);
$data[] = $vals;
}
if (++$count > $params['limit']) {
// We've reached the one extra which shows that
// there are additional pages to be had. Stop here...
- $this->setContinueEnumParameter('continue', "{$row->il_from}|{$row->il_to}");
+ $this->setContinueEnumParameter('continue', $row->cl_from .
+ '|' . $this->keyToTitle($row->cl_to));
break;
}
'timestamp',
)
),
+ 'show' => array(
+ ApiBase :: PARAM_ISMULTI => true,
+ ApiBase :: PARAM_TYPE => array(
+ 'hidden',
+ '!hidden',
+ )
+ ),
'limit' => array(
ApiBase :: PARAM_DFLT => 10,
ApiBase :: PARAM_TYPE => 'limit',
public function getParamDescription() {
return array (
'prop' => 'Which additional properties to get for each category.',
- 'limit' => 'How many langlinks to return',
+ 'limit' => 'How many categories to return',
+ 'show' => 'Which kind of categories to show',
'continue' => 'When more results are available, use this to continue',
);
}