*/
private static $QueryMetaModules = [
'allmessages' => 'ApiQueryAllMessages',
+ 'authmanagerinfo' => 'ApiQueryAuthManagerInfo',
'siteinfo' => 'ApiQuerySiteinfo',
'userinfo' => 'ApiQueryUserInfo',
'filerepoinfo' => 'ApiQueryFileRepoInfo',
return $this->mPageSet;
}
- /**
- * Get the generators array mapping module names to class names
- * @deprecated since 1.21, list of generators is maintained by ApiPageSet
- * @return array Array(modulename => classname)
- */
- public function getGenerators() {
- wfDeprecated( __METHOD__, '1.21' );
- $gens = [];
- foreach ( $this->mModuleMgr->getNamesWithClasses() as $name => $class ) {
- if ( is_subclass_of( $class, 'ApiQueryGeneratorBase' ) ) {
- $gens[$name] = $class;
- }
- }
-
- return $gens;
- }
-
- /**
- * Get whether the specified module is a prop, list or a meta query module
- * @deprecated since 1.21, use getModuleManager()->getModuleGroup()
- * @param string $moduleName Name of the module to find type for
- * @return string|null
- */
- function getModuleType( $moduleName ) {
- return $this->getModuleManager()->getModuleGroup( $moduleName );
- }
-
/**
* @return ApiFormatRaw|null
*/
}
}
- /**
- * This method is called by the generator base when generator in the smart-continue
- * mode tries to set 'query-continue' value. ApiQuery stores those values separately
- * until the post-processing when it is known if the generation should continue or repeat.
- * @deprecated since 1.24
- * @param ApiQueryGeneratorBase $module Generator module
- * @param string $paramName
- * @param mixed $paramValue
- * @return bool True if processed, false if this is a legacy continue
- */
- public function setGeneratorContinue( $module, $paramName, $paramValue ) {
- wfDeprecated( __METHOD__, '1.24' );
- $this->getContinuationManager()->addGeneratorContinueParam( $module, $paramName, $paramValue );
- return !$this->getParameter( 'rawcontinue' );
- }
-
/**
* @param ApiPageSet $pageSet Pages to be exported
* @param ApiResult $result Result to output to
return implode( "\n", $moduleDescriptions );
}
+ public function isReadMode() {
+ // We need to make an exception for certain meta modules that should be
+ // accessible even without the 'read' right. Restrict the exception as
+ // much as possible: no other modules allowed, and no pageset
+ // parameters either. We do allow the 'rawcontinue' and 'indexpageids'
+ // parameters since frameworks might add these unconditionally and they
+ // can't expose anything here.
+ $this->mParams = $this->extractRequestParams();
+ $params = array_filter(
+ array_diff_key(
+ $this->mParams + $this->getPageSet()->extractRequestParams(),
+ [ 'rawcontinue' => 1, 'indexpageids' => 1 ]
+ )
+ );
+ if ( array_keys( $params ) !== [ 'meta' ] ) {
+ return true;
+ }
+
+ // Ask each module if it requires read mode. Any true => this returns
+ // true.
+ $modules = [];
+ $this->instantiateModules( $modules, 'meta' );
+ foreach ( $modules as $module ) {
+ if ( $module->isReadMode() ) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
protected function getExamplesMessages() {
return [
'action=query&prop=revisions&meta=siteinfo&' .