* (bug 13428) Fix regression in protection form layout HTML validity
* (bug 9403) Sanitize newlines from search term input
* (bug 13429) Separate date and time in message sp-newimages-showfrom
+* (bug 13137) Allow setting 'editprotected' right separately from 'protect',
+ so groups may optionally edit protected pages without having 'protect' perms
=== API changes in 1.13 ===
* (bug 13390) One invalid title no longer kills an entire API query
* (bug 13419) Fix gblredirect so it actually works
* (bug 13418) Disable eiredirect because it's useless
-* (bug 13137) Allow setting 'editprotected' right separately from 'protect',
- so groups may optionally edit protected pages without having 'protect' perms
+* (bug 13395) list=allcategories should use category table
=== Languages updated in 1.13 ===
$db = $this->getDB();
$params = $this->extractRequestParams();
- $this->addTables('categorylinks');
- $this->addFields('cl_to');
+ $this->addTables('category');
+ $this->addFields('cat_title');
if (!is_null($params['from']))
- $this->addWhere('cl_to>=' . $db->addQuotes(ApiQueryBase :: titleToKey($params['from'])));
+ $this->addWhere('cat_title>=' . $db->addQuotes(ApiQueryBase :: titleToKey($params['from'])));
if (isset ($params['prefix']))
- $this->addWhere("cl_to LIKE '" . $db->escapeLike(ApiQueryBase :: titleToKey($params['prefix'])) . "%'");
+ $this->addWhere("cat_title LIKE '" . $db->escapeLike(ApiQueryBase :: titleToKey($params['prefix'])) . "%'");
$this->addOption('LIMIT', $params['limit']+1);
- $this->addOption('ORDER BY', 'cl_to' . ($params['dir'] == 'descending' ? ' DESC' : ''));
+ $this->addOption('ORDER BY', 'cat_title' . ($params['dir'] == 'descending' ? ' DESC' : ''));
$this->addOption('DISTINCT');
+
+ $prop = array_flip($params['prop']);
+ $this->addFieldsIf( array( 'cat_pages', 'cat_subcats', 'cat_files' ), isset($prop['size']) );
+ //$this->addFieldsIf( 'cat_hidden', isset($prop['hidden']) );
$res = $this->select(__METHOD__);
$pages = array();
+ $categories = array();
+ $result = $this->getResult();
$count = 0;
while ($row = $db->fetchObject($res)) {
if (++ $count > $params['limit']) {
}
// Normalize titles
- $titleObj = Title::makeTitle(NS_CATEGORY, $row->cl_to);
+ $titleObj = Title::makeTitle(NS_CATEGORY, $row->cat_title);
if(!is_null($resultPageSet))
$pages[] = $titleObj->getPrefixedText();
- else
- // Don't show "Category:" everywhere in non-generator mode
- $pages[] = $titleObj->getText();
+ else {
+ $item = array();
+ $result->setContent( $item, $titleObj->getText() );
+ if( isset( $prop['size'] ) ) {
+ $item['size'] = $row->cat_pages;
+ $item['pages'] = $row->cat_pages - $row->cat_subcats - $row->cat_files;
+ $item['files'] = $row->cat_files;
+ $item['subcats'] = $row->cat_subcats;
+ }
+ //Isn't populated, so doesn't work
+ //if( isset( $prop['hidden'] ) && $row->cat_hidden )
+ // $item['hidden'] = '';
+ $categories[] = $item;
+ }
}
$db->freeResult($res);
if (is_null($resultPageSet)) {
- $result = $this->getResult();
- $result->setIndexedTagName($pages, 'c');
- $result->addValue('query', $this->getModuleName(), $pages);
+ $result->setIndexedTagName($categories, 'c');
+ $result->addValue('query', $this->getModuleName(), $categories);
} else {
$resultPageSet->populateFromTitles($pages);
}
ApiBase :: PARAM_MIN => 1,
ApiBase :: PARAM_MAX => ApiBase :: LIMIT_BIG1,
ApiBase :: PARAM_MAX2 => ApiBase :: LIMIT_BIG2
- )
+ ),
+ 'prop' => array (
+ ApiBase :: PARAM_TYPE => array( 'size', /*'hidden'*/ ),
+ ApiBase :: PARAM_DFLT => '',
+ ApiBase :: PARAM_ISMULTI => true
+ ),
);
}
'from' => 'The category to start enumerating from.',
'prefix' => 'Search for all category titles that begin with this value.',
'dir' => 'Direction to sort in.',
- 'limit' => 'How many categories to return.'
+ 'limit' => 'How many categories to return.',
+ 'prop' => 'Indicates if API should output category size',
);
}
protected function getExamples() {
return array (
+ 'api.php?action=query&list=allcategories&acprop=size',
'api.php?action=query&generator=allcategories&gacprefix=List&prop=info',
);
}