1
0
Fork 0

Merge branch 'master' of github.com:composer/composer into 4254-remove-autoload_files.php-when-needed

pull/4359/head
voroks 2015-08-19 15:08:57 +08:00
commit e873438dbd
2 changed files with 67 additions and 1 deletions

View File

@ -18,6 +18,7 @@ use Composer\DependencyResolver\Operation\UpdateOperation;
use Composer\DependencyResolver\Operation\InstallOperation;
use Composer\DependencyResolver\Operation\UninstallOperation;
use Composer\DependencyResolver\Operation\OperationInterface;
use Composer\DependencyResolver\PolicyInterface;
use Composer\DependencyResolver\Pool;
use Composer\DependencyResolver\Request;
use Composer\DependencyResolver\Rule;
@ -43,6 +44,7 @@ use Composer\Repository\InstalledFilesystemRepository;
use Composer\Repository\PlatformRepository;
use Composer\Repository\RepositoryInterface;
use Composer\Repository\RepositoryManager;
use Composer\Repository\WritableRepositoryInterface;
use Composer\Script\ScriptEvents;
/**
@ -353,6 +355,14 @@ class Installer
return 0;
}
/**
* @param RepositoryInterface $localRepo
* @param RepositoryInterface $installedRepo
* @param PlatformRepository $platformRepo
* @param array $aliases
* @param bool $withDevReqs
* @return int
*/
protected function doInstall($localRepo, $installedRepo, $platformRepo, $aliases, $withDevReqs)
{
// init vars
@ -615,7 +625,7 @@ class Installer
if (!$this->dryRun) {
// force source/dist urls to be updated for all packages
$operations = $this->processPackageUrls($pool, $policy, $localRepo, $repositories);
$this->processPackageUrls($pool, $policy, $localRepo, $repositories);
$localRepo->write();
}
@ -686,6 +696,11 @@ class Installer
return array_merge($uninstOps, $operations);
}
/**
* @param bool $withDevReqs
* @param RepositoryInterface|null $lockedRepository
* @return Pool
*/
private function createPool($withDevReqs, RepositoryInterface $lockedRepository = null)
{
if (!$this->update && $this->locker->isLocked()) { // install from lock
@ -724,6 +739,9 @@ class Installer
return new Pool($minimumStability, $stabilityFlags, $rootConstraints);
}
/**
* @return DefaultPolicy
*/
private function createPolicy()
{
$preferStable = null;
@ -744,6 +762,11 @@ class Installer
return new DefaultPolicy($preferStable, $preferLowest);
}
/**
* @param RootPackageInterface $rootPackage
* @param PlatformRepository $platformRepo
* @return Request
*/
private function createRequest(RootPackageInterface $rootPackage, PlatformRepository $platformRepo)
{
$request = new Request();
@ -777,6 +800,19 @@ class Installer
return $request;
}
/**
* @param WritableRepositoryInterface $localRepo
* @param Pool $pool
* @param PolicyInterface $policy
* @param array $repositories
* @param RepositoryInterface $installedRepo
* @param RepositoryInterface $lockedRepository
* @param bool $installFromLock
* @param bool $withDevReqs
* @param string $task
* @param array|null $operations
* @return array
*/
private function processDevPackages($localRepo, $pool, $policy, $repositories, $installedRepo, $lockedRepository, $installFromLock, $withDevReqs, $task, array $operations = null)
{
if ($task === 'force-updates' && null === $operations) {
@ -909,6 +945,9 @@ class Installer
/**
* Loads the most "current" list of packages that are installed meaning from lock ideally or from installed repo as fallback
* @param bool $withDevReqs
* @param RepositoryInterface $installedRepo
* @return array
*/
private function getCurrentPackages($withDevReqs, $installedRepo)
{
@ -924,6 +963,9 @@ class Installer
return $installedRepo->getPackages();
}
/**
* @return array
*/
private function getRootAliases()
{
if (!$this->update && $this->locker->isLocked()) {
@ -944,6 +986,12 @@ class Installer
return $normalizedAliases;
}
/**
* @param Pool $pool
* @param PolicyInterface $policy
* @param WritableRepositoryInterface $localRepo
* @param array $repositories
*/
private function processPackageUrls($pool, $policy, $localRepo, $repositories)
{
if (!$this->update) {
@ -984,6 +1032,10 @@ class Installer
}
}
/**
* @param PlatformRepository $platformRepo
* @param array $aliases
*/
private function aliasPlatformPackages(PlatformRepository $platformRepo, $aliases)
{
foreach ($aliases as $package => $versions) {
@ -998,6 +1050,10 @@ class Installer
}
}
/**
* @param PackageInterface $package
* @return bool
*/
private function isUpdateable(PackageInterface $package)
{
if (!$this->updateWhitelist) {
@ -1027,6 +1083,10 @@ class Installer
return "{^" . $cleanedWhiteListedPattern . "$}i";
}
/**
* @param array $links
* @return array
*/
private function extractPlatformRequirements($links)
{
$platformReqs = array();
@ -1179,6 +1239,10 @@ class Installer
);
}
/**
* @param RepositoryInterface $additionalInstalledRepository
* @return $this
*/
public function setAdditionalInstalledRepository(RepositoryInterface $additionalInstalledRepository)
{
$this->additionalInstalledRepository = $additionalInstalledRepository;

View File

@ -227,6 +227,8 @@ class RemoteFilesystem
if (preg_match('{^content-encoding: *gzip *$}i', $header)) {
$decode = true;
} elseif (preg_match('{^HTTP/}i', $header)) {
// In case of redirects, http_response_headers contains the headers of all responses
// so we reset the flag when a new response is being parsed as we are only interested in the last response
$decode = false;
}
}