MediaWiki
master
Toggle main menu visibility
ApiQueryAllCategories.php
Go to the documentation of this file.
1
<?php
8
9
namespace
MediaWiki\Api
;
10
11
use Wikimedia\ParamValidator\ParamValidator;
12
use Wikimedia\ParamValidator\TypeDef\IntegerDef;
13
20
class
ApiQueryAllCategories
extends
ApiQueryCategoryList
{
21
22
public
function
__construct
(
ApiQuery
$query,
string
$moduleName ) {
23
parent::__construct( $query, $moduleName,
'ac'
);
24
}
25
26
public
function
execute
() {
27
$this->run();
28
}
29
31
public
function
getCacheMode
( $params ) {
32
return
'public'
;
33
}
34
36
public
function
executeGenerator
( $resultPageSet ) {
37
$this->run( $resultPageSet );
38
}
39
43
private
function
run( $resultPageSet =
null
) {
44
$db = $this->
getDB
();
45
$params = $this->
extractRequestParams
();
46
47
$this->
createQuery
( $db, $params );
48
$this->
executeQuery
( $params, $resultPageSet );
49
}
50
52
public
function
getAllowedParams
() {
53
return
[
54
'from'
=>
null
,
55
'continue'
=> [
56
ApiBase::PARAM_HELP_MSG
=>
'api-help-param-continue'
,
57
],
58
'to'
=>
null
,
59
'prefix'
=>
null
,
60
'dir'
=> [
61
ParamValidator::PARAM_DEFAULT =>
'ascending'
,
62
ParamValidator::PARAM_TYPE => [
63
'ascending'
,
64
'descending'
65
],
66
],
67
'min'
=> [
68
ParamValidator::PARAM_TYPE =>
'integer'
69
],
70
'max'
=> [
71
ParamValidator::PARAM_TYPE =>
'integer'
72
],
73
'limit'
=> [
74
ParamValidator::PARAM_DEFAULT => 10,
75
ParamValidator::PARAM_TYPE =>
'limit'
,
76
IntegerDef::PARAM_MIN => 1,
77
IntegerDef::PARAM_MAX =>
ApiBase::LIMIT_BIG1
,
78
IntegerDef::PARAM_MAX2 =>
ApiBase::LIMIT_BIG2
79
],
80
'prop'
=> [
81
ParamValidator::PARAM_TYPE => [
'size'
,
'hidden'
],
82
ParamValidator::PARAM_DEFAULT =>
''
,
83
ParamValidator::PARAM_ISMULTI =>
true
,
84
ApiBase::PARAM_HELP_MSG_PER_VALUE
=> [],
85
],
86
];
87
}
88
90
protected
function
getExamplesMessages
() {
91
return
[
92
'action=query&list=allcategories&acprop=size'
93
=>
'apihelp-query+allcategories-example-size'
,
94
'action=query&generator=allcategories&gacprefix=List&prop=info'
95
=>
'apihelp-query+allcategories-example-generator'
,
96
];
97
}
98
100
public
function
getHelpUrls
() {
101
return
'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Allcategories'
;
102
}
103
}
104
106
class_alias( ApiQueryAllCategories::class,
'ApiQueryAllCategories'
);
MediaWiki\Api\ApiBase\PARAM_HELP_MSG_PER_VALUE
const PARAM_HELP_MSG_PER_VALUE
((string|array|Message)[]) When PARAM_TYPE is an array, or 'string' with PARAM_ISMULTI,...
Definition
ApiBase.php:205
MediaWiki\Api\ApiBase\PARAM_HELP_MSG
const PARAM_HELP_MSG
(string|array|Message) Specify an alternative i18n documentation message for this parameter.
Definition
ApiBase.php:165
MediaWiki\Api\ApiBase\LIMIT_BIG2
const LIMIT_BIG2
Fast query, apihighlimits limit.
Definition
ApiBase.php:232
MediaWiki\Api\ApiBase\extractRequestParams
extractRequestParams( $options=[])
Using getAllowedParams(), this function makes an array of the values provided by the user,...
Definition
ApiBase.php:830
MediaWiki\Api\ApiBase\LIMIT_BIG1
const LIMIT_BIG1
Fast query, standard limit.
Definition
ApiBase.php:230
MediaWiki\Api\ApiQueryAllCategories
Query module to enumerate all categories, even the ones that don't have category pages.
Definition
ApiQueryAllCategories.php:20
MediaWiki\Api\ApiQueryAllCategories\getAllowedParams
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
Definition
ApiQueryAllCategories.php:52
MediaWiki\Api\ApiQueryAllCategories\__construct
__construct(ApiQuery $query, string $moduleName)
Definition
ApiQueryAllCategories.php:22
MediaWiki\Api\ApiQueryAllCategories\getExamplesMessages
getExamplesMessages()
Returns usage examples for this module.Return value has query strings as keys, with values being eith...
Definition
ApiQueryAllCategories.php:90
MediaWiki\Api\ApiQueryAllCategories\getCacheMode
getCacheMode( $params)
Get the cache mode for the data generated by this module.Override this in the module subclass....
Definition
ApiQueryAllCategories.php:31
MediaWiki\Api\ApiQueryAllCategories\executeGenerator
executeGenerator( $resultPageSet)
Execute this module as a generator.
Definition
ApiQueryAllCategories.php:36
MediaWiki\Api\ApiQueryAllCategories\execute
execute()
Evaluates the parameters, performs the requested query, and sets up the result.
Definition
ApiQueryAllCategories.php:26
MediaWiki\Api\ApiQueryAllCategories\getHelpUrls
getHelpUrls()
Return links to more detailed help pages about the module.1.25, returning boolean false is deprecated...
Definition
ApiQueryAllCategories.php:100
MediaWiki\Api\ApiQueryCategoryList
Definition
ApiQueryCategoryList.php:10
MediaWiki\Api\ApiQueryCategoryList\createQuery
createQuery(IReadableDatabase $db, array $params)
Definition
ApiQueryCategoryList.php:12
MediaWiki\Api\ApiQueryCategoryList\executeQuery
executeQuery(array $params, ?ApiPageSet $resultPageSet=null, array $options=[])
Definition
ApiQueryCategoryList.php:69
MediaWiki\Api\ApiQuery
This is the main query class.
Definition
ApiQuery.php:36
MediaWiki\Api
Definition
ApiAcquireTempUserName.php:8
MediaWiki\Api\getDB
getDB()
includes
Api
ApiQueryAllCategories.php
Generated on
for MediaWiki by
1.18.0