diff options
Diffstat (limited to 'vendor/composer/InstalledVersions.php')
-rw-r--r-- | vendor/composer/InstalledVersions.php | 151 |
1 files changed, 99 insertions, 52 deletions
diff --git a/vendor/composer/InstalledVersions.php b/vendor/composer/InstalledVersions.php index d46574ac8..97df88926 100644 --- a/vendor/composer/InstalledVersions.php +++ b/vendor/composer/InstalledVersions.php @@ -12,6 +12,7 @@ namespace Composer; +use Composer\Autoload\ClassLoader; use Composer\Semver\VersionParser; @@ -24,12 +25,12 @@ class InstalledVersions private static $installed = array ( 'root' => array ( - 'pretty_version' => 'dev-master', - 'version' => 'dev-master', + 'pretty_version' => 'dev-5.2RC', + 'version' => 'dev-5.2RC', 'aliases' => array ( ), - 'reference' => '08c9152abdfa90da09931bdcc6e6c81ea243434c', + 'reference' => '34b28cd8d36c7805e65c442ff1588ccf5165387a', 'name' => 'zotlabs/hubzilla', ), 'versions' => @@ -115,24 +116,6 @@ private static $installed = array ( ), 'reference' => 'c83178d49e372ca967d1a8c77ae4e051b3a3c75c', ), - 'paragonie/constant_time_encoding' => - array ( - 'pretty_version' => 'v2.4.0', - 'version' => '2.4.0.0', - 'aliases' => - array ( - ), - 'reference' => 'f34c2b11eb9d2c9318e13540a1dbc2a3afbd939c', - ), - 'paragonie/random_compat' => - array ( - 'pretty_version' => 'v9.99.100', - 'version' => '9.99.100.0', - 'aliases' => - array ( - ), - 'reference' => '996434e5492cb4c3edcb9168db6fbb1359ef965a', - ), 'pear/text_languagedetect' => array ( 'pretty_version' => 'v1.0.1', @@ -144,12 +127,12 @@ private static $installed = array ( ), 'phpseclib/phpseclib' => array ( - 'pretty_version' => '3.0.4', - 'version' => '3.0.4.0', + 'pretty_version' => '2.0.30', + 'version' => '2.0.30.0', 'aliases' => array ( ), - 'reference' => '845a2275e886ba9fb386c8f59cb383dd9c8963e9', + 'reference' => '136b9ca7eebef78be14abf90d65c5e57b6bc5d36', ), 'psr/log' => array ( @@ -284,15 +267,17 @@ private static $installed = array ( ), 'zotlabs/hubzilla' => array ( - 'pretty_version' => 'dev-master', - 'version' => 'dev-master', + 'pretty_version' => 'dev-5.2RC', + 'version' => 'dev-5.2RC', 'aliases' => array ( ), - 'reference' => '08c9152abdfa90da09931bdcc6e6c81ea243434c', + 'reference' => '34b28cd8d36c7805e65c442ff1588ccf5165387a', ), ), ); +private static $canGetVendors; +private static $installedByVendor = array(); @@ -302,7 +287,17 @@ private static $installed = array ( public static function getInstalledPackages() { -return array_keys(self::$installed['versions']); +$packages = array(); +foreach (self::getInstalled() as $installed) { +$packages[] = array_keys($installed['versions']); +} + + +if (1 === \count($packages)) { +return $packages[0]; +} + +return array_keys(array_flip(\call_user_func_array('array_merge', $packages))); } @@ -315,7 +310,13 @@ return array_keys(self::$installed['versions']); public static function isInstalled($packageName) { -return isset(self::$installed['versions'][$packageName]); +foreach (self::getInstalled() as $installed) { +if (isset($installed['versions'][$packageName])) { +return true; +} +} + +return false; } @@ -350,42 +351,50 @@ return $provided->matches($constraint); public static function getVersionRanges($packageName) { -if (!isset(self::$installed['versions'][$packageName])) { -throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); +foreach (self::getInstalled() as $installed) { +if (!isset($installed['versions'][$packageName])) { +continue; } $ranges = array(); -if (isset(self::$installed['versions'][$packageName]['pretty_version'])) { -$ranges[] = self::$installed['versions'][$packageName]['pretty_version']; +if (isset($installed['versions'][$packageName]['pretty_version'])) { +$ranges[] = $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('aliases', $installed['versions'][$packageName])) { +$ranges = array_merge($ranges, $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('replaced', $installed['versions'][$packageName])) { +$ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']); } -if (array_key_exists('provided', self::$installed['versions'][$packageName])) { -$ranges = array_merge($ranges, self::$installed['versions'][$packageName]['provided']); +if (array_key_exists('provided', $installed['versions'][$packageName])) { +$ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']); } return implode(' || ', $ranges); } +throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); +} + public static function getVersion($packageName) { -if (!isset(self::$installed['versions'][$packageName])) { -throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); +foreach (self::getInstalled() as $installed) { +if (!isset($installed['versions'][$packageName])) { +continue; } -if (!isset(self::$installed['versions'][$packageName]['version'])) { +if (!isset($installed['versions'][$packageName]['version'])) { return null; } -return self::$installed['versions'][$packageName]['version']; +return $installed['versions'][$packageName]['version']; +} + +throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); } @@ -394,15 +403,19 @@ 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'); +foreach (self::getInstalled() as $installed) { +if (!isset($installed['versions'][$packageName])) { +continue; } -if (!isset(self::$installed['versions'][$packageName]['pretty_version'])) { +if (!isset($installed['versions'][$packageName]['pretty_version'])) { return null; } -return self::$installed['versions'][$packageName]['pretty_version']; +return $installed['versions'][$packageName]['pretty_version']; +} + +throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); } @@ -411,15 +424,19 @@ 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'); +foreach (self::getInstalled() as $installed) { +if (!isset($installed['versions'][$packageName])) { +continue; } -if (!isset(self::$installed['versions'][$packageName]['reference'])) { +if (!isset($installed['versions'][$packageName]['reference'])) { return null; } -return self::$installed['versions'][$packageName]['reference']; +return $installed['versions'][$packageName]['reference']; +} + +throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); } @@ -428,7 +445,9 @@ return self::$installed['versions'][$packageName]['reference']; public static function getRootPackage() { -return self::$installed['root']; +$installed = self::getInstalled(); + +return $installed[0]['root']; } @@ -463,5 +482,33 @@ return self::$installed; public static function reload($data) { self::$installed = $data; +self::$installedByVendor = array(); +} + + + + +private static function getInstalled() +{ +if (null === self::$canGetVendors) { +self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders'); +} + +$installed = array(); + +if (self::$canGetVendors) { + +foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { +if (isset(self::$installedByVendor[$vendorDir])) { +$installed[] = self::$installedByVendor[$vendorDir]; +} elseif (is_file($vendorDir.'/composer/installed.php')) { +$installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php'; +} +} +} + +$installed[] = self::$installed; + +return $installed; } } |