Page MenuHomePhabricator

Installed libraries doesn't include vendor dirs in extensions/skins
Open, LowPublic

Description

SpecialVersion:

		$paths = [
			MW_INSTALL_PATH . '/vendor/composer/installed.json'
		];

		$extensionTypes = self::getExtensionTypes();
		foreach ( $extensionTypes as $type => $message ) {
			if ( !isset( $credits[$type] ) || $credits[$type] === [] ) {
				continue;
			}
			foreach ( $credits[$type] as $extension ) {
				if ( !isset( $extension['path'] ) ) {
					continue;
				}
				$paths[] = dirname( $extension['path'] ) . '/vendor/composer/installed.json';
			}
		}

		$dependencies = [];

		foreach ( $paths as $path ) {
			if ( !file_exists( $path ) ) {
				continue;
			}

			$installed = new ComposerInstalled( $path );

			$dependencies += $installed->getInstalledDependencies();
		}

		if ( $dependencies === [] ) {
			return '';
		}

		ksort( $dependencies );

ApiQuerySiteInfo

		$path = MW_INSTALL_PATH . '/vendor/composer/installed.json';
		if ( !file_exists( $path ) ) {
			return true;
		}

		$data = [];
		$installed = new ComposerInstalled( $path );
		foreach ( $installed->getInstalledDependencies() as $name => $info ) {
			if ( str_starts_with( $info['type'], 'mediawiki-' ) ) {
				// Skip any extensions or skins since they'll be listed
				// in their proper section
				continue;
			}
			$data[] = [
				'name' => $name,
				'version' => $info['version'],
			];
		}
		ApiResult::setIndexedTagName( $data, 'library' );

Event Timeline

Change 992508 had a related patch set uploaded (by Reedy; author: Reedy):

[mediawiki/core@master] ApiQuerySiteInfo: Expose same PHP Libraries as SpecialVersion

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