435 lines
8.7 KiB
PHP
435 lines
8.7 KiB
PHP
<?php
|
|
|
|
namespace Composer;
|
|
|
|
use Composer\Semver\VersionParser;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class InstalledVersions
|
|
{
|
|
private static $installed = array (
|
|
'root' =>
|
|
array (
|
|
'pretty_version' => '1.0.0+no-version-set',
|
|
'version' => '1.0.0.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => NULL,
|
|
'name' => 'taoser/taoler',
|
|
),
|
|
'versions' =>
|
|
array (
|
|
'firebase/php-jwt' =>
|
|
array (
|
|
'pretty_version' => 'v5.2.1',
|
|
'version' => '5.2.1.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => 'f42c9110abe98dd6cfe9053c49bc86acc70b2d23',
|
|
),
|
|
'league/flysystem' =>
|
|
array (
|
|
'pretty_version' => '1.1.3',
|
|
'version' => '1.1.3.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '9be3b16c877d477357c015cec057548cf9b2a14a',
|
|
),
|
|
'league/flysystem-cached-adapter' =>
|
|
array (
|
|
'pretty_version' => '1.1.0',
|
|
'version' => '1.1.0.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => 'd1925efb2207ac4be3ad0c40b8277175f99ffaff',
|
|
),
|
|
'league/mime-type-detection' =>
|
|
array (
|
|
'pretty_version' => '1.7.0',
|
|
'version' => '1.7.0.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '3b9dff8aaf7323590c1d2e443db701eb1f9aa0d3',
|
|
),
|
|
'lotofbadcode/phpspirit_databackup' =>
|
|
array (
|
|
'pretty_version' => 'v1.1',
|
|
'version' => '1.1.0.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '2627b2e4206031731c94c8d637fb06b3b96e8860',
|
|
),
|
|
'phpmailer/phpmailer' =>
|
|
array (
|
|
'pretty_version' => 'v6.4.1',
|
|
'version' => '6.4.1.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '9256f12d8fb0cd0500f93b19e18c356906cbed3d',
|
|
),
|
|
'psr/cache' =>
|
|
array (
|
|
'pretty_version' => '1.0.1',
|
|
'version' => '1.0.1.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => 'd11b50ad223250cf17b86e38383413f5a6764bf8',
|
|
),
|
|
'psr/container' =>
|
|
array (
|
|
'pretty_version' => '1.1.1',
|
|
'version' => '1.1.1.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '8622567409010282b7aeebe4bb841fe98b58dcaf',
|
|
),
|
|
'psr/log' =>
|
|
array (
|
|
'pretty_version' => '1.1.4',
|
|
'version' => '1.1.4.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => 'd49695b909c3b7628b6289db5479a1c204601f11',
|
|
),
|
|
'psr/simple-cache' =>
|
|
array (
|
|
'pretty_version' => '1.0.1',
|
|
'version' => '1.0.1.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '408d5eafb83c57f6365a3ca330ff23aa4a5fa39b',
|
|
),
|
|
'symfony/polyfill-mbstring' =>
|
|
array (
|
|
'pretty_version' => 'v1.22.1',
|
|
'version' => '1.22.1.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '5232de97ee3b75b0360528dae24e73db49566ab1',
|
|
),
|
|
'symfony/polyfill-php72' =>
|
|
array (
|
|
'pretty_version' => 'v1.22.1',
|
|
'version' => '1.22.1.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => 'cc6e6f9b39fe8075b3dabfbaf5b5f645ae1340c9',
|
|
),
|
|
'symfony/polyfill-php80' =>
|
|
array (
|
|
'pretty_version' => 'v1.22.1',
|
|
'version' => '1.22.1.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => 'dc3063ba22c2a1fd2f45ed856374d79114998f91',
|
|
),
|
|
'symfony/var-dumper' =>
|
|
array (
|
|
'pretty_version' => 'v4.4.22',
|
|
'version' => '4.4.22.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => 'c194bcedde6295f3ec3e9eba1f5d484ea97c41a7',
|
|
),
|
|
'taoser/taoler' =>
|
|
array (
|
|
'pretty_version' => '1.0.0+no-version-set',
|
|
'version' => '1.0.0.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => NULL,
|
|
),
|
|
'taoser/think-auth' =>
|
|
array (
|
|
'pretty_version' => 'v1.0.0',
|
|
'version' => '1.0.0.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '19bb04e4fb957a95ff3fdc142939922c19167b43',
|
|
),
|
|
'topthink/framework' =>
|
|
array (
|
|
'pretty_version' => 'v6.0.8',
|
|
'version' => '6.0.8.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '4789343672aef06d571d556da369c0e156609bce',
|
|
),
|
|
'topthink/think-captcha' =>
|
|
array (
|
|
'pretty_version' => 'v3.0.3',
|
|
'version' => '3.0.3.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '1eef3717c1bcf4f5bbe2d1a1c704011d330a8b55',
|
|
),
|
|
'topthink/think-helper' =>
|
|
array (
|
|
'pretty_version' => 'v3.1.4',
|
|
'version' => '3.1.4.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => 'c28d37743bda4a0455286ca85b17b5791d626e10',
|
|
),
|
|
'topthink/think-multi-app' =>
|
|
array (
|
|
'pretty_version' => 'v1.0.14',
|
|
'version' => '1.0.14.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => 'ccaad7c2d33f42cb1cc2a78d6610aaec02cea4c3',
|
|
),
|
|
'topthink/think-orm' =>
|
|
array (
|
|
'pretty_version' => 'v2.0.40',
|
|
'version' => '2.0.40.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '1119d979b850849f3725856460cf108eec1c3eb8',
|
|
),
|
|
'topthink/think-template' =>
|
|
array (
|
|
'pretty_version' => 'v2.0.8',
|
|
'version' => '2.0.8.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => 'abfc293f74f9ef5127b5c416310a01fe42e59368',
|
|
),
|
|
'topthink/think-trace' =>
|
|
array (
|
|
'pretty_version' => 'v1.4',
|
|
'version' => '1.4.0.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '9a9fa8f767b6c66c5a133ad21ca1bc96ad329444',
|
|
),
|
|
'topthink/think-view' =>
|
|
array (
|
|
'pretty_version' => 'v1.0.14',
|
|
'version' => '1.0.14.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => 'edce0ae2c9551ab65f9e94a222604b0dead3576d',
|
|
),
|
|
'wamkj/thinkphp6.0-databackup' =>
|
|
array (
|
|
'pretty_version' => 'v1.0',
|
|
'version' => '1.0.0.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '28a0e406d827132942723a3c9f69bb20c98e652f',
|
|
),
|
|
'zzstudio/think-addons' =>
|
|
array (
|
|
'pretty_version' => '2.0.5',
|
|
'version' => '2.0.5.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '7eb740cb219a111d593a05ad88248a74f640fe5c',
|
|
),
|
|
),
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static function getInstalledPackages()
|
|
{
|
|
return array_keys(self::$installed['versions']);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static function isInstalled($packageName)
|
|
{
|
|
return isset(self::$installed['versions'][$packageName]);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static function satisfies(VersionParser $parser, $packageName, $constraint)
|
|
{
|
|
$constraint = $parser->parseConstraints($constraint);
|
|
$provided = $parser->parseConstraints(self::getVersionRanges($packageName));
|
|
|
|
return $provided->matches($constraint);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static function getVersionRanges($packageName)
|
|
{
|
|
if (!isset(self::$installed['versions'][$packageName])) {
|
|
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
|
}
|
|
|
|
$ranges = array();
|
|
if (isset(self::$installed['versions'][$packageName]['pretty_version'])) {
|
|
$ranges[] = self::$installed['versions'][$packageName]['pretty_version'];
|
|
}
|
|
if (array_key_exists('aliases', self::$installed['versions'][$packageName])) {
|
|
$ranges = array_merge($ranges, self::$installed['versions'][$packageName]['aliases']);
|
|
}
|
|
if (array_key_exists('replaced', self::$installed['versions'][$packageName])) {
|
|
$ranges = array_merge($ranges, self::$installed['versions'][$packageName]['replaced']);
|
|
}
|
|
if (array_key_exists('provided', self::$installed['versions'][$packageName])) {
|
|
$ranges = array_merge($ranges, self::$installed['versions'][$packageName]['provided']);
|
|
}
|
|
|
|
return implode(' || ', $ranges);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static function getVersion($packageName)
|
|
{
|
|
if (!isset(self::$installed['versions'][$packageName])) {
|
|
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
|
}
|
|
|
|
if (!isset(self::$installed['versions'][$packageName]['version'])) {
|
|
return null;
|
|
}
|
|
|
|
return self::$installed['versions'][$packageName]['version'];
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static function getPrettyVersion($packageName)
|
|
{
|
|
if (!isset(self::$installed['versions'][$packageName])) {
|
|
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
|
}
|
|
|
|
if (!isset(self::$installed['versions'][$packageName]['pretty_version'])) {
|
|
return null;
|
|
}
|
|
|
|
return self::$installed['versions'][$packageName]['pretty_version'];
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static function getReference($packageName)
|
|
{
|
|
if (!isset(self::$installed['versions'][$packageName])) {
|
|
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
|
}
|
|
|
|
if (!isset(self::$installed['versions'][$packageName]['reference'])) {
|
|
return null;
|
|
}
|
|
|
|
return self::$installed['versions'][$packageName]['reference'];
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static function getRootPackage()
|
|
{
|
|
return self::$installed['root'];
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static function getRawData()
|
|
{
|
|
return self::$installed;
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static function reload($data)
|
|
{
|
|
self::$installed = $data;
|
|
}
|
|
}
|