'CompareParserCache' => __DIR__ . '/maintenance/compareParserCache.php',
'CompareParsers' => __DIR__ . '/maintenance/compareParsers.php',
'ComposerHookHandler' => __DIR__ . '/includes/composer/ComposerHookHandler.php',
+ 'ComposerInstalled' => __DIR__ . '/includes/libs/composer/ComposerInstalled.php',
'ComposerJson' => __DIR__ . '/includes/libs/composer/ComposerJson.php',
'ComposerLock' => __DIR__ . '/includes/libs/composer/ComposerLock.php',
'ComposerPackageModifier' => __DIR__ . '/includes/composer/ComposerPackageModifier.php',
protected function appendInstalledLibraries( $property ) {
global $IP;
- $path = "$IP/composer.lock";
+ $path = "$IP/vendor/composer/installed.json";
if ( !file_exists( $path ) ) {
- // Maybe they're using mediawiki/vendor?
- $path = "$IP/vendor/composer.lock";
- if ( !file_exists( $path ) ) {
- return true;
- }
+ return true;
}
$data = array();
- $lock = new ComposerLock( $path );
- foreach ( $lock->getInstalledDependencies() as $name => $info ) {
+ $installed = new ComposerInstalled( $path );
+ foreach ( $installed->getInstalledDependencies() as $name => $info ) {
if ( strpos( $info['type'], 'mediawiki-' ) === 0 ) {
// Skip any extensions or skins since they'll be listed
// in their proper section
--- /dev/null
+<?php
+
+/**
+ * Reads an installed.json file and provides accessors to get what is
+ * installed
+ *
+ * @since 1.27
+ */
+class ComposerInstalled {
+
+ /**
+ * @param string $location
+ */
+ public function __construct( $location ) {
+ $this->contents = json_decode( file_get_contents( $location ), true );
+ }
+
+ /**
+ * Dependencies currently installed according to installed.json
+ *
+ * @return array
+ */
+ public function getInstalledDependencies() {
+ $deps = array();
+ foreach ( $this->contents as $installed ) {
+ $deps[$installed['name']] = array(
+ 'version' => ComposerJson::normalizeVersion( $installed['version'] ),
+ 'type' => $installed['type'],
+ 'licenses' => isset( $installed['license'] ) ? $installed['license'] : array(),
+ 'authors' => isset( $installed['authors'] ) ? $installed['authors'] : array(),
+ 'description' => isset( $installed['description'] ) ? $installed['description']: '',
+ );
+ }
+
+ ksort( $deps );
+ return $deps;
+ }
+}
*/
protected function getExternalLibraries() {
global $IP;
- $path = "$IP/composer.lock";
+ $path = "$IP/vendor/composer/installed.json";
if ( !file_exists( $path ) ) {
- // Maybe they're using mediawiki/vendor?
- $path = "$IP/vendor/composer.lock";
- if ( !file_exists( $path ) ) {
- return '';
- }
+ return '';
}
- $lock = new ComposerLock( $path );
+ $installed = new ComposerInstalled( $path );
$out = Html::element(
'h2',
array( 'id' => 'mw-version-libraries' ),
. Html::element( 'th', array(), $this->msg( 'version-libraries-authors' )->text() )
. Html::closeElement( 'tr' );
- foreach ( $lock->getInstalledDependencies() as $name => $info ) {
+ foreach ( $installed->getInstalledDependencies() as $name => $info ) {
if ( strpos( $info['type'], 'mediawiki-' ) === 0 ) {
// Skip any extensions or skins since they'll be listed
// in their proper section