if (!defined('MEDIAWIKI')) {
// Eclipse helper - will be ignored in production
- require_once ("ApiQueryBase.php");
+ require_once ('ApiQueryBase.php');
}
class ApiQueryAllpages extends ApiQueryBase {
if ($apfilterredir === 'redirects')
$where['page_is_redirect'] = 1;
- else
- if ($apfilterredir === 'nonredirects')
- $where['page_is_redirect'] = 0;
+ elseif ($apfilterredir === 'nonredirects') $where['page_is_redirect'] = 0;
$this->profileDBIn();
$res = $db->select('page', array (
'ORDER BY' => 'page_namespace, page_title'
));
$this->profileDBOut();
-
+
$data = array ();
- $data['_element'] = 'p';
+ ApiResult :: setIndexedTagName($data, 'p');
$count = 0;
while ($row = $db->fetchObject($res)) {
if (++ $count > $aplimit) {
$msg = array (
'continue' => 'apfrom=' . ApiQueryBase :: keyToTitle($row->page_title
));
- $this->getResult()->addMessage('query-status', 'allpages', $msg);
+ $this->getResult()->addValue('query-status', 'allpages', $msg);
break;
}
if ($title->getNamespace() !== 0)
$pagedata['ns'] = $title->getNamespace();
$pagedata['title'] = $title->getPrefixedText();
- $pagedata['*'] = '';
$data[$id] = $pagedata;
}
}
$db->freeResult($res);
- $this->getResult()->addMessage('query', 'allpages', $data);
+ $this->getResult()->addValue('query', 'allpages', $data);
}
protected function getAllowedParams() {
return array (
'apfrom' => null,
'apnamespace' => array (
- GN_ENUM_DFLT => 0,
- GN_ENUM_TYPE => $validNamespaces
+ ApiBase :: PARAM_DFLT => 0,
+ ApiBase :: PARAM_TYPE => $validNamespaces
),
'apfilterredir' => array (
- GN_ENUM_DFLT => 'all',
- GN_ENUM_TYPE => array (
+ ApiBase :: PARAM_DFLT => 'all',
+ ApiBase :: PARAM_TYPE => array (
'all',
'redirects',
'nonredirects'
)
),
'aplimit' => array (
- GN_ENUM_DFLT => 10,
- GN_ENUM_TYPE => 'limit',
- GN_ENUM_MIN => 1,
- GN_ENUM_MAX1 => 500,
- GN_ENUM_MAX2 => 5000
+ ApiBase :: PARAM_DFLT => 10,
+ ApiBase :: PARAM_TYPE => 'limit',
+ ApiBase :: PARAM_MIN => 1,
+ ApiBase :: PARAM_MAX1 => 500,
+ ApiBase :: PARAM_MAX2 => 5000
)
);
}
'api.php?action=query&list=allpages&apfrom=B&aplimit=5'
);
}
+
public function getCanGenerate() {
return true;
}
+
+ public function getVersion() {
+ return __CLASS__ . ': $Id$';
+ }
}
?>
\ No newline at end of file