diff options
Diffstat (limited to 'vendor/composer/InstalledVersions.php')
-rw-r--r-- | vendor/composer/InstalledVersions.php | 164 |
1 files changed, 122 insertions, 42 deletions
diff --git a/vendor/composer/InstalledVersions.php b/vendor/composer/InstalledVersions.php index 0e6b84d2a..337b81d14 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; @@ -19,6 +20,8 @@ use Composer\Semver\VersionParser; + + class InstalledVersions { private static $installed = array ( @@ -29,7 +32,7 @@ private static $installed = array ( 'aliases' => array ( ), - 'reference' => '6fae291cc8ec69a74d0c1673186b3d8f319378d4', + 'reference' => '3e18efd89fd1bd67f3cef22114f7d74ac7c0021c', 'name' => 'zotlabs/hubzilla', ), 'versions' => @@ -63,12 +66,12 @@ private static $installed = array ( ), 'commerceguys/intl' => array ( - 'pretty_version' => 'v1.0.7', - 'version' => '1.0.7.0', + 'pretty_version' => 'v1.1.0', + 'version' => '1.1.0.0', 'aliases' => array ( ), - 'reference' => '0bf0beb12e37ef1a61e0d09dc66cdaa1a23e62e1', + 'reference' => '90b4f75c4917927a1960c0dcaa002a91ab97f5d5', ), 'desandro/imagesloaded' => array ( @@ -90,12 +93,12 @@ private static $installed = array ( ), 'league/html-to-markdown' => array ( - 'pretty_version' => '4.10.0', - 'version' => '4.10.0.0', + 'pretty_version' => '5.0.0', + 'version' => '5.0.0.0', 'aliases' => array ( ), - 'reference' => '0868ae7a552e809e5cd8f93ba022071640408e88', + 'reference' => 'c4dbebbebe0fe454b6b38e6c683a977615bd7dc2', ), 'lukasreschke/id3parser' => array ( @@ -135,12 +138,12 @@ private static $installed = array ( ), 'psr/log' => array ( - 'pretty_version' => '1.1.3', - 'version' => '1.1.3.0', + 'pretty_version' => '1.1.4', + 'version' => '1.1.4.0', 'aliases' => array ( ), - 'reference' => '0f73288fd15629204f9d42b7055f72dacbe811fc', + 'reference' => 'd49695b909c3b7628b6289db5479a1c204601f11', ), 'ramsey/collection' => array ( @@ -232,21 +235,21 @@ private static $installed = array ( ), 'smarty/smarty' => array ( - 'pretty_version' => 'v3.1.38', - 'version' => '3.1.38.0', + 'pretty_version' => 'v3.1.39', + 'version' => '3.1.39.0', 'aliases' => array ( ), - 'reference' => '63b3c0aed0f614880cda21a5c08c606e97b489bb', + 'reference' => 'e27da524f7bcd7361e3ea5cdfa99c4378a7b5419', ), 'symfony/polyfill-ctype' => array ( - 'pretty_version' => 'v1.22.0', - 'version' => '1.22.0.0', + 'pretty_version' => 'v1.23.0', + 'version' => '1.23.0.0', 'aliases' => array ( ), - 'reference' => 'c6c942b1ac76c82448322025e084cadc56048b4e', + 'reference' => '46cd95797e9df938fdd2b03693b5fca5e64b01ce', ), 'twbs/bootstrap' => array ( @@ -271,10 +274,12 @@ private static $installed = array ( 'aliases' => array ( ), - 'reference' => '6fae291cc8ec69a74d0c1673186b3d8f319378d4', + 'reference' => '3e18efd89fd1bd67f3cef22114f7d74ac7c0021c', ), ), ); +private static $canGetVendors; +private static $installedByVendor = array(); @@ -284,7 +289,16 @@ 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))); } @@ -297,7 +311,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; } @@ -332,42 +352,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'); } @@ -376,15 +404,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'); } @@ -393,15 +425,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'); } @@ -410,7 +446,9 @@ return self::$installed['versions'][$packageName]['reference']; public static function getRootPackage() { -return self::$installed['root']; +$installed = self::getInstalled(); + +return $installed[0]['root']; } @@ -419,8 +457,11 @@ return self::$installed['root']; + public static function getRawData() { +@trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED); + return self::$installed; } @@ -430,6 +471,17 @@ return self::$installed; +public static function getAllRawData() +{ +return self::getInstalled(); +} + + + + + + + @@ -445,5 +497,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; } } |