48 parent::__construct( $query, $moduleName,
'fri' );
49 $this->repoGroup = $repoGroup;
56 $props = array_fill_keys( $params[
'prop'],
true );
60 $foreignTargets = $conf->get( MainConfigNames::ForeignUploadTargets );
62 $this->repoGroup->forEachForeignRepo(
63 static function (
FileRepo $repo ) use ( &$repos, $props, $foreignTargets ) {
65 $repoProps[
'canUpload'] = in_array( $repoProps[
'name'], $foreignTargets );
67 $repos[] = array_intersect_key( $repoProps, $props );
71 $localInfo = $this->repoGroup->getLocalRepo()->getInfo();
72 $localInfo[
'canUpload'] = $conf->get( MainConfigNames::EnableUploads );
73 $repos[] = array_intersect_key( $localInfo, $props );
76 ApiResult::setIndexedTagName( $repos,
'repo' );
77 ApiResult::setArrayTypeRecursive( $repos,
'assoc' );
78 ApiResult::setArrayType( $repos,
'array' );
79 $result->addValue( [
'query' ],
'repos', $repos );
91 ParamValidator::PARAM_DEFAULT => implode(
'|', $props ),
92 ParamValidator::PARAM_ISMULTI =>
true,
93 ParamValidator::PARAM_TYPE => $props,
101 $this->repoGroup->forEachForeignRepo(
static function (
FileRepo $repo ) use ( &$props ) {
102 $props = array_merge( $props, array_keys( $repo->
getInfo() ) );
105 $propValues = array_values( array_unique( array_merge(
107 array_keys( $this->repoGroup->getLocalRepo()->getInfo() )
110 $propValues[] =
'canUpload';
119 $props = array_intersect( [
'apiurl',
'name',
'displayname' ], $this->
getProps() );
121 $examples[
'action=query&meta=filerepoinfo&friprop=' . implode(
'|', $props )] =
122 'apihelp-query+filerepoinfo-example-simple';
129 return 'https://www.mediawiki.org/wiki/Special:MyLanguage/API:Filerepoinfo';
const PARAM_HELP_MSG_PER_VALUE
((string|array|Message)[]) When PARAM_TYPE is an array, this is an array mapping those values to $msg...
getResult()
Get the result object.
extractRequestParams( $options=[])
Using getAllowedParams(), this function makes an array of the values provided by the user,...
This is a base class for all Query modules.
A query action to return meta information about the foreign file repos configured on the wiki.
__construct(ApiQuery $query, $moduleName, RepoGroup $repoGroup)
execute()
Evaluates the parameters, performs the requested query, and sets up the result.
getAllowedParams()
Returns an array of allowed parameters (parameter name) => (default value) or (parameter name) => (ar...
getExamplesMessages()
Returns usage examples for this module.
getHelpUrls()
Return links to more detailed help pages about the module.
getCacheMode( $params)
Get the cache mode for the data generated by this module.
This is the main query class.
Base class for file repositories.
getInfo()
Return information about the repository.
A class containing constants representing the names of configuration variables.
Prioritized list of file repositories.