Legoktm has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/182097

Change subject: Expose installed external libraries on Special:Version
......................................................................

Expose installed external libraries on Special:Version

Change-Id: Ic767a06ccfd938fbe519333bbd683f6116aaa262
---
M includes/specials/SpecialVersion.php
M languages/i18n/en.json
M languages/i18n/qqq.json
3 files changed, 46 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/97/182097/1

diff --git a/includes/specials/SpecialVersion.php 
b/includes/specials/SpecialVersion.php
index 34f434f..4c3b4be 100644
--- a/includes/specials/SpecialVersion.php
+++ b/includes/specials/SpecialVersion.php
@@ -132,6 +132,7 @@
                                $out->addHtml(
                                        $this->getSkinCredits() .
                                        $this->getExtensionCredits() .
+                                       $this->getExternalLibraries() .
                                        $this->getParserTags() .
                                        $this->getParserFunctionHooks()
                                );
@@ -504,6 +505,45 @@
        }
 
        /**
+        * Generate an HTML table for external libraries that are installed
+        *
+        * @return string
+        */
+       protected function getExternalLibraries() {
+               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 '';
+                       }
+               }
+
+               $lock = new ComposerLock( $path );
+               $out = Html::element(
+                       'h2',
+                       array( 'id' => 'mw-version-libraries' ),
+                       $this->msg( 'version-libraries' )->text()
+               );
+               $out .= Html::openElement( 'table', array( 'class' => 
'wikitable plainlinks', 'id' => 'sv-libraries' ) );
+               $out .= Html::openElement( 'tr' )
+                       . Html::element( 'th', array(), $this->msg( 
'version-libraries-library' )->text() )
+                       . Html::element( 'th', array(), $this->msg( 
'version-libraries-version' )->text() )
+                       . Html::closeElement( 'tr' );
+               ;
+               foreach ( $lock->getInstalledDependencies() as $name => 
$version ) {
+                       $out .= Html::openElement( 'tr' )
+                               . Html::rawElement( 'td', array(), 
Linker::makeExternalLink( "https://packagist.org/packages/$name";, $name ) )
+                               . Html::element( 'td', array(), $version )
+                               . Html::closeElement( 'tr' );
+               }
+               $out .= Html::closeElement( 'table' );
+
+               return $out;
+       }
+
+       /**
         * Obtains a list of installed parser tags and the associated H2 header
         *
         * @return string HTML output
diff --git a/languages/i18n/en.json b/languages/i18n/en.json
index 4b4188d..08754ee 100644
--- a/languages/i18n/en.json
+++ b/languages/i18n/en.json
@@ -3288,6 +3288,9 @@
        "version-entrypoints-index-php": 
"[https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:index.php 
index.php]",
        "version-entrypoints-api-php": 
"[https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:api.php api.php]",
        "version-entrypoints-load-php": 
"[https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:load.php load.php]",
+       "version-libraries": "Installed libraries",
+       "version-libraries-library": "Library",
+       "version-libraries-version": "Version",
        "redirect": "Redirect by file, user, page or revision ID",
        "redirect-legend": "Redirect to a file or page",
        "redirect-text": "",
diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json
index 4387623..ab8ecc5 100644
--- a/languages/i18n/qqq.json
+++ b/languages/i18n/qqq.json
@@ -3452,6 +3452,9 @@
        "version-entrypoints-index-php": "A short description of the index.php 
entry point. Links to the mediawiki.org documentation page for index.php.",
        "version-entrypoints-api-php": "A short description of the api.php 
entry point. Links to the mediawiki.org documentation page for api.php.",
        "version-entrypoints-load-php": "A short description of the load.php 
entry point. Links to the mediawiki.org documentation page for load.php.",
+       "version-libraries": "Header on [[Special:Version]] above a table that 
lists installed external libraries and their version numbers.",
+       "version-libraries-library": "Column header for the library's name",
+       "version-libraries-version": "Column header for the library's version 
number",
        "redirect": "{{doc-special|Redirect}}\nThis means \"Redirect by 
file'''name''', user '''ID''', page '''ID''', or revision ID\".",
        "redirect-legend": "Legend of fieldset around input box in 
[[Special:Redirect]]",
        "redirect-text": "Inside fieldset for [[Special:Redirect]]",

-- 
To view, visit https://gerrit.wikimedia.org/r/182097
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic767a06ccfd938fbe519333bbd683f6116aaa262
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Legoktm <legoktm.wikipe...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to