mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2024-11-05 06:22:54 +00:00
0c7fd9a34d
- Upgrading phpseclib/phpseclib (2.0.4 => 2.0.34) - Upgrading singpolyma/openpgp-php (0.3.0 => 0.5.0)
227 lines
3.7 KiB
PHP
227 lines
3.7 KiB
PHP
<?php
|
|
|
|
namespace Composer;
|
|
|
|
use Composer\Semver\VersionParser;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class InstalledVersions
|
|
{
|
|
private static $installed = array (
|
|
'root' =>
|
|
array (
|
|
'pretty_version' => 'dev-develop',
|
|
'version' => 'dev-develop',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => 'fb77e3c5ea0bcc6497dd6f24960b3d9ff1a159bd',
|
|
'name' => 'friendica-addons/securemail',
|
|
),
|
|
'versions' =>
|
|
array (
|
|
'friendica-addons/securemail' =>
|
|
array (
|
|
'pretty_version' => 'dev-develop',
|
|
'version' => 'dev-develop',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => 'fb77e3c5ea0bcc6497dd6f24960b3d9ff1a159bd',
|
|
),
|
|
'phpseclib/phpseclib' =>
|
|
array (
|
|
'pretty_version' => '2.0.34',
|
|
'version' => '2.0.34.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '98a6fe587f3481aea319eef7e656d02cfe1675ec',
|
|
),
|
|
'singpolyma/openpgp-php' =>
|
|
array (
|
|
'pretty_version' => '0.5.0',
|
|
'version' => '0.5.0.0',
|
|
'aliases' =>
|
|
array (
|
|
),
|
|
'reference' => '69292f6a46ed7f687083bfb8974b161a41ab213c',
|
|
),
|
|
),
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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;
|
|
}
|
|
}
|