API: Use param-per-value for meta=filerepoinfo's friprop docs
authorBrad Jorsch <bjorsch@wikimedia.org>
Wed, 20 Jun 2018 14:08:26 +0000 (10:08 -0400)
committerBrad Jorsch <bjorsch@wikimedia.org>
Wed, 20 Jun 2018 14:47:18 +0000 (10:47 -0400)
This avoids documenting properties that may not be valid on the local
wiki, depending on which repos are actually available.

This patch also documents the other values available from repo types
available in MediaWiki core.

Bug: T197730
Change-Id: I6bf9fbf4ac29042d9f7524c6c1a5990051150cd3

includes/api/ApiQueryFileRepoInfo.php
includes/api/i18n/en.json
includes/api/i18n/qqq.json

index 4589991..279bc0a 100644 (file)
@@ -81,6 +81,7 @@ class ApiQueryFileRepoInfo extends ApiQueryBase {
                                ApiBase::PARAM_DFLT => implode( '|', $props ),
                                ApiBase::PARAM_ISMULTI => true,
                                ApiBase::PARAM_TYPE => $props,
+                               ApiBase::PARAM_HELP_MSG_PER_VALUE => [],
                        ],
                ];
        }
@@ -100,14 +101,20 @@ class ApiQueryFileRepoInfo extends ApiQueryBase {
 
                $propValues[] = 'canUpload';
 
+               sort( $propValues );
                return $propValues;
        }
 
        protected function getExamplesMessages() {
-               return [
-                       'action=query&meta=filerepoinfo&friprop=apiurl|name|displayname'
-                               => 'apihelp-query+filerepoinfo-example-simple',
-               ];
+               $examples = [];
+
+               $props = array_intersect( [ 'apiurl', 'name', 'displayname' ], $this->getProps() );
+               if ( $props ) {
+                       $examples['action=query&meta=filerepoinfo&friprop=' . implode( '|', $props )] =
+                               'apihelp-query+filerepoinfo-example-simple';
+               }
+
+               return $examples;
        }
 
        public function getHelpUrls() {
index 94e1ac6..74efd82 100644 (file)
        "apihelp-query+filearchive-example-simple": "Show a list of all deleted files.",
 
        "apihelp-query+filerepoinfo-summary": "Return meta information about image repositories configured on the wiki.",
-       "apihelp-query+filerepoinfo-param-prop": "Which repository properties to get (there may be more available on some wikis):\n;apiurl:URL to the repository API - helpful for getting image info from the host.\n;name:The key of the repository - used in e.g. <var>[[mw:Special:MyLanguage/Manual:$wgForeignFileRepos|$wgForeignFileRepos]]</var> and [[Special:ApiHelp/query+imageinfo|imageinfo]] return values.\n;displayname:The human-readable name of the repository wiki.\n;rooturl:Root URL for image paths.\n;local:Whether that repository is the local one or not.",
+       "apihelp-query+filerepoinfo-param-prop": "Which repository properties to get (properties available may vary on other wikis).",
+       "apihelp-query+filerepoinfo-paramvalue-prop-apiurl": "URL to the repository API - helpful for getting image info from the host.",
+       "apihelp-query+filerepoinfo-paramvalue-prop-articlepath": "Repository wiki's <var>[[mw:Special:MyLanguage/Manual:$wgArticlePath|$wgArticlePath]]</var> or equivalent.",
+       "apihelp-query+filerepoinfo-paramvalue-prop-canUpload": "Whether files can be uploaded to this repository, e.g. via CORS and shared authentication.",
+       "apihelp-query+filerepoinfo-paramvalue-prop-displayname": "The human-readable name of the repository wiki.",
+       "apihelp-query+filerepoinfo-paramvalue-prop-favicon": "Repository wiki's favicon URL, from <var>[[mw:Special:MyLanguage/Manual:$wgFavicon|$wgFavicon]]</var>.",
+       "apihelp-query+filerepoinfo-paramvalue-prop-fetchDescription": "Whether file description pages are fetched from this repository when viewing local file description pages.",
+       "apihelp-query+filerepoinfo-paramvalue-prop-initialCapital": "Whether file names implicitly start with a capital letter.",
+       "apihelp-query+filerepoinfo-paramvalue-prop-local": "Whether that repository is the local one or not.",
+       "apihelp-query+filerepoinfo-paramvalue-prop-name": "The key of the repository - used in e.g. <var>[[mw:Special:MyLanguage/Manual:$wgForeignFileRepos|$wgForeignFileRepos]]</var> and [[Special:ApiHelp/query+imageinfo|imageinfo]] return values.",
+       "apihelp-query+filerepoinfo-paramvalue-prop-rootUrl": "Root URL path for image paths.",
+       "apihelp-query+filerepoinfo-paramvalue-prop-scriptDirUrl": "Root URL path for the repository wiki's MediaWiki installation.",
+       "apihelp-query+filerepoinfo-paramvalue-prop-server": "Repository wiki's <var>[[mw:Special:MyLanguage/Manual:$wgServer|$wgServer]]</var> or equivalent.",
+       "apihelp-query+filerepoinfo-paramvalue-prop-thumbUrl": "Root URL path for thumbnail paths.",
+       "apihelp-query+filerepoinfo-paramvalue-prop-url": "Public zone URL path.",
        "apihelp-query+filerepoinfo-example-simple": "Get information about file repositories.",
 
        "apihelp-query+fileusage-summary": "Find all pages that use the given files.",
index 1680bb8..2b4a587 100644 (file)
        "apihelp-query+filearchive-example-simple": "{{doc-apihelp-example|query+filearchive}}",
        "apihelp-query+filerepoinfo-summary": "{{doc-apihelp-summary|query+filerepoinfo}}",
        "apihelp-query+filerepoinfo-param-prop": "{{doc-apihelp-param|query+filerepoinfo|prop}}",
+       "apihelp-query+filerepoinfo-paramvalue-prop-apiurl": "{{doc-apihelp-paramvalue|query+filerepoinfo|prop|apiurl}}",
+       "apihelp-query+filerepoinfo-paramvalue-prop-articlepath": "{{doc-apihelp-paramvalue|query+filerepoinfo|prop|articlepath}}",
+       "apihelp-query+filerepoinfo-paramvalue-prop-canUpload": "{{doc-apihelp-paramvalue|query+filerepoinfo|prop|canUpload}}",
+       "apihelp-query+filerepoinfo-paramvalue-prop-displayname": "{{doc-apihelp-paramvalue|query+filerepoinfo|prop|displayname}}",
+       "apihelp-query+filerepoinfo-paramvalue-prop-favicon": "{{doc-apihelp-paramvalue|query+filerepoinfo|prop|favicon}}",
+       "apihelp-query+filerepoinfo-paramvalue-prop-fetchDescription": "{{doc-apihelp-paramvalue|query+filerepoinfo|prop|fetchDescription}}",
+       "apihelp-query+filerepoinfo-paramvalue-prop-initialCapital": "{{doc-apihelp-paramvalue|query+filerepoinfo|prop|initialCapital}}",
+       "apihelp-query+filerepoinfo-paramvalue-prop-local": "{{doc-apihelp-paramvalue|query+filerepoinfo|prop|local}}",
+       "apihelp-query+filerepoinfo-paramvalue-prop-name": "{{doc-apihelp-paramvalue|query+filerepoinfo|prop|name}}",
+       "apihelp-query+filerepoinfo-paramvalue-prop-rootUrl": "{{doc-apihelp-paramvalue|query+filerepoinfo|prop|rootUrl}}",
+       "apihelp-query+filerepoinfo-paramvalue-prop-scriptDirUrl": "{{doc-apihelp-paramvalue|query+filerepoinfo|prop|scriptDirUrl}}",
+       "apihelp-query+filerepoinfo-paramvalue-prop-server": "{{doc-apihelp-paramvalue|query+filerepoinfo|prop|server}}",
+       "apihelp-query+filerepoinfo-paramvalue-prop-thumbUrl": "{{doc-apihelp-paramvalue|query+filerepoinfo|prop|thumbUrl}}",
+       "apihelp-query+filerepoinfo-paramvalue-prop-url": "{{doc-apihelp-paramvalue|query+filerepoinfo|prop|url}}",
        "apihelp-query+filerepoinfo-example-simple": "{{doc-apihelp-example|query+filerepoinfo}}",
        "apihelp-query+fileusage-summary": "{{doc-apihelp-summary|query+fileusage}}",
        "apihelp-query+fileusage-param-prop": "{{doc-apihelp-param|query+fileusage|prop|paramvalues=1}}",