jenkins-bot has submitted this change and it was merged.
Change subject: Expose installed libraries in action=query&meta=siteinfo
......................................................................
Expose installed libraries in action=query&meta=siteinfo
Bug: T89385
Change-Id: I4256f4d9858c09c042f649b7e701189acf85aedd
---
M RELEASE-NOTES-1.25
M includes/api/ApiQuerySiteinfo.php
M includes/api/i18n/en.json
3 files changed, 39 insertions(+), 2 deletions(-)
Approvals:
BryanDavis: Looks good to me, approved
Paladox: Looks good to me, but someone else must approve
jenkins-bot: Verified
diff --git a/RELEASE-NOTES-1.25 b/RELEASE-NOTES-1.25
index 3f24db0..eb9fe38 100644
--- a/RELEASE-NOTES-1.25
+++ b/RELEASE-NOTES-1.25
@@ -86,7 +86,9 @@
* External libraries installed via composer will now be displayed
on Special:Version in their own section. Extensions or skins that are
installed via composer will not be shown in this section as it is assumed
- they will add the proper credits to the skins or extensions section.
+ they will add the proper credits to the skins or extensions section. They
+ can also be accessed through the API via the new siprop=libraries to
+ ApiQuerySiteInfo.
* Update QUnit from v1.14.0 to v1.16.0.
* Update Moment.js from v2.8.3 to v2.8.4.
* Special:Tags now allows for manipulating the list of user-modifiable change
@@ -208,6 +210,7 @@
log entry is not implemented yet.
* list=tags has additional properties to indicate 'active' status and tag
sources.
+* siprop=libraries was added to ApiQuerySiteInfo to list installed external
libraries.
=== Action API internal changes in 1.25 ===
* ApiHelp has been rewritten to support i18n and paginated HTML output.
diff --git a/includes/api/ApiQuerySiteinfo.php
b/includes/api/ApiQuerySiteinfo.php
index 4e5c42b..5ac1036 100644
--- a/includes/api/ApiQuerySiteinfo.php
+++ b/includes/api/ApiQuerySiteinfo.php
@@ -69,6 +69,9 @@
case 'usergroups':
$fit = $this->appendUserGroups( $p,
$params['numberingroup'] );
break;
+ case 'libraries':
+ $fit = $this->appendInstalledLibraries(
$p );
+ break;
case 'extensions':
$fit = $this->appendExtensions( $p );
break;
@@ -554,6 +557,36 @@
return $this->getResult()->addValue( 'query', $property, $data
);
}
+ protected function appendInstalledLibraries( $property ) {
+ global $IP;
+ $path = "$IP/composer.lock";
+ if ( !file_exists( $path ) ) {
+ // Maybe they're using mediawiki/vendor?
+ $path = "$IP/vendor/composer.lock";
+ if ( !file_exists( $path ) ) {
+ return true;
+ }
+ }
+
+ $data = array();
+ $lock = new ComposerLock( $path );
+ foreach ( $lock->getInstalledDependencies() as $name => $info )
{
+ if ( strpos( $info['type'], 'mediawiki-' ) === 0 ) {
+ // Skip any extensions or skins since they'll
be listed
+ // in their proper section
+ continue;
+ }
+ $data[] = array(
+ 'name' => $name,
+ 'version' => $info['version'],
+ );
+ }
+ $this->getResult()->setIndexedTagName( $data, 'library' );
+
+ return $this->getResult()->addValue( 'query', $property, $data
);
+
+ }
+
protected function appendExtensions( $property ) {
$data = array();
foreach ( $this->getConfig()->get( 'ExtensionCredits' ) as
$type => $extensions ) {
@@ -810,6 +843,7 @@
'dbrepllag',
'statistics',
'usergroups',
+ 'libraries',
'extensions',
'fileextensions',
'rightsinfo',
diff --git a/includes/api/i18n/en.json b/includes/api/i18n/en.json
index 0e766bf..6779571 100644
--- a/includes/api/i18n/en.json
+++ b/includes/api/i18n/en.json
@@ -871,7 +871,7 @@
"apihelp-query+search-example-generator": "Ger page info about the
pages returned for a search for <kbd>meaning</kbd>.",
"apihelp-query+siteinfo-description": "Return general information about
the site.",
- "apihelp-query+siteinfo-param-prop": "Which information to
get:\n;general:Overall system information.\n;namespaces:List of registered
namespaces and their canonical names.\n;namespacealiases:List of registered
namespace aliases.\n;specialpagealiases:List of special page
aliases.\n;magicwords:List of magic words and their
aliases.\n;statistics:Returns site statistics.\n;interwikimap:Returns interwiki
map (optionally filtered, optionally localised by using
<var>$1inlanguagecode</var>).\n;dbrepllag:Returns database server with the
highest replication lag.\n;usergroups:Returns user groups and the associated
permissions.\n;extensions:Returns extensions installed on the
wiki.\n;fileextensions:Returns list of file extensions allowed to be
uploaded.\n;rightsinfo:Returns wiki rights (license) information if
available.\n;restrictions:Returns information on available restriction
(protection) types.\n;languages:Returns a list of languages MediaWiki supports
(optionally localised by using <var>$1inlanguagecode</var>).\n;skins:Returns a
list of all enabled skins (optionally localised by using
<var>$1inlanguagecode</var>, otherwise in the content
language).\n;extensiontags:Returns a list of parser extension
tags.\n;functionhooks:Returns a list of parser function
hooks.\n;showhooks:Returns a list of all subscribed hooks (contents of
<var>[[mw:Manual:$wgHooks|$wgHooks]]</var>).\n;variables:Returns a list of
variable IDs.\n;protocols:Returns a list of protocols that are allowed in
external links.\n;defaultoptions:Returns the default values for user
preferences.",
+ "apihelp-query+siteinfo-param-prop": "Which information to
get:\n;general:Overall system information.\n;namespaces:List of registered
namespaces and their canonical names.\n;namespacealiases:List of registered
namespace aliases.\n;specialpagealiases:List of special page
aliases.\n;magicwords:List of magic words and their
aliases.\n;statistics:Returns site statistics.\n;interwikimap:Returns interwiki
map (optionally filtered, optionally localised by using
<var>$1inlanguagecode</var>).\n;dbrepllag:Returns database server with the
highest replication lag.\n;usergroups:Returns user groups and the associated
permissions.\n;libraries:Returns libraries installed on the
wiki.\n;extensions:Returns extensions installed on the
wiki.\n;fileextensions:Returns list of file extensions allowed to be
uploaded.\n;rightsinfo:Returns wiki rights (license) information if
available.\n;restrictions:Returns information on available restriction
(protection) types.\n;languages:Returns a list of languages MediaWiki supports
(optionally localised by using <var>$1inlanguagecode</var>).\n;skins:Returns a
list of all enabled skins (optionally localised by using
<var>$1inlanguagecode</var>, otherwise in the content
language).\n;extensiontags:Returns a list of parser extension
tags.\n;functionhooks:Returns a list of parser function
hooks.\n;showhooks:Returns a list of all subscribed hooks (contents of
<var>[[mw:Manual:$wgHooks|$wgHooks]]</var>).\n;variables:Returns a list of
variable IDs.\n;protocols:Returns a list of protocols that are allowed in
external links.\n;defaultoptions:Returns the default values for user
preferences.",
"apihelp-query+siteinfo-param-filteriw": "Return only local or only
nonlocal entries of the interwiki map.",
"apihelp-query+siteinfo-param-showalldb": "List all database servers,
not just the one lagging the most.",
"apihelp-query+siteinfo-param-numberingroup": "Lists the number of
users in user groups.",
--
To view, visit https://gerrit.wikimedia.org/r/190348
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I4256f4d9858c09c042f649b7e701189acf85aedd
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>
Gerrit-Reviewer: Anomie <[email protected]>
Gerrit-Reviewer: BryanDavis <[email protected]>
Gerrit-Reviewer: Jamie Thingelstad <[email protected]>
Gerrit-Reviewer: Kghbln <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: Legoktm <[email protected]>
Gerrit-Reviewer: Paladox <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits