45 parent::__construct( $query, $moduleName,
'pp' );
46 $this->pageProps = $pageProps;
50 # Only operate on existing pages
54 if ( $params[
'continue'] ) {
55 $continueValue = (int)$params[
'continue'];
58 foreach ( $pages as $id => $page ) {
59 if ( $id >= $continueValue ) {
60 $filteredPages[$id] = $page;
63 $pages = $filteredPages;
66 if ( $pages === [] ) {
71 if ( $params[
'prop'] ) {
72 $properties = $this->pageProps->getProperties( $pages, $params[
'prop'] );
74 $properties = $this->pageProps->getAllProperties( $pages );
80 foreach ( $properties as $pageid => $props ) {
81 if ( !$this->addPageProps( $result, $pageid, $props ) ) {
96 private function addPageProps( $result, $page, $props ) {
97 ApiResult::setArrayType( $props,
'assoc' );
98 $fit = $result->addValue( [
'query',
'pages', $page ],
'pageprops', $props );
117 ParamValidator::PARAM_ISMULTI =>
true,
123 $title = Title::newMainPage()->getPrefixedText();
124 $mp = rawurlencode(
$title );
127 "action=query&prop=pageprops&titles={$mp}|MediaWiki"
128 =>
'apihelp-query+pageprops-example-simple',
133 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Pageprops';
dieContinueUsageIf( $condition)
Die with the 'badcontinue' error.
getResult()
Get the result object.
extractRequestParams( $options=[])
Using getAllowedParams(), this function makes an array of the values provided by the user,...
const PARAM_HELP_MSG
(string|array|Message) Specify an alternative i18n documentation message for this parameter.
This is a base class for all Query modules.
setContinueEnumParameter( $paramName, $paramValue)
Set a query-continue value.
getPageSet()
Get the PageSet object to work on.
A query module to show basic page information.
__construct(ApiQuery $query, $moduleName, PageProps $pageProps)
getHelpUrls()
Return links to more detailed help pages about the module.
getExamplesMessages()
Returns usage examples for this module.
execute()
Evaluates the parameters, performs the requested query, and sets up the result.
getCacheMode( $params)
Get the cache mode for the data generated by this module.
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
This is the main query class.
Gives access to properties of a page.