/** * @param array $systemPackages * @return array */ public function getInstalledSystemPackages($systemPackages) { $systemPackages = []; $locker = $this->magentoComposerApplication->createComposer()->getLocker(); /** @var \Composer\Package\CompletePackage $package */ foreach ($locker->getLockedRepository()->getPackages() as $package) { $packageName = $package->getName(); if ($this->composerInfo->isSystemPackage($packageName)) { if ($packageName == 'magento/product-community-edition') { if ($this->composerInfo->isPackageInComposerJson($packageName)) { $systemPackages[] = $packageName; } } else { $systemPackages[] = $packageName; } } } return $systemPackages; }
/** * @param array $systemPackages * @return array * @throws \RuntimeException */ public function getInstalledSystemPackages($systemPackages) { $systemPackages = []; $locker = $this->magentoComposerApplication->createComposer()->getLocker(); /** @var \Composer\Package\CompletePackage $package */ foreach ($locker->getLockedRepository()->getPackages() as $package) { $packageName = $package->getName(); if ($this->composerInfo->isSystemPackage($packageName)) { if ($packageName == 'magento/product-community-edition') { if ($this->composerInfo->isPackageInComposerJson($packageName)) { $systemPackages[] = $packageName; } } else { $systemPackages[] = $packageName; } } } if (empty($systemPackages)) { throw new \RuntimeException('We\'re sorry, no components are available because you cloned the Magento 2 GitHub repository. ' . 'You must manually update components as discussed in the ' . '<a href="http://devdocs.magento.com/guides/v2.0/install-gde/install/cli/dev_options.html">' . 'Installation Guide</a>.'); } return $systemPackages; }