diff --git a/composer.lock b/composer.lock index aa50c62df..73c009d82 100644 --- a/composer.lock +++ b/composer.lock @@ -160,16 +160,16 @@ }, { "name": "composer/spdx-licenses", - "version": "1.5.3", + "version": "1.5.4", "source": { "type": "git", "url": "https://github.com/composer/spdx-licenses.git", - "reference": "0c3e51e1880ca149682332770e25977c70cf9dae" + "reference": "6946f785871e2314c60b4524851f3702ea4f2223" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/spdx-licenses/zipball/0c3e51e1880ca149682332770e25977c70cf9dae", - "reference": "0c3e51e1880ca149682332770e25977c70cf9dae", + "url": "https://api.github.com/repos/composer/spdx-licenses/zipball/6946f785871e2314c60b4524851f3702ea4f2223", + "reference": "6946f785871e2314c60b4524851f3702ea4f2223", "shasum": "" }, "require": { @@ -219,9 +219,23 @@ "support": { "irc": "irc://irc.freenode.org/composer", "issues": "https://github.com/composer/spdx-licenses/issues", - "source": "https://github.com/composer/spdx-licenses/tree/1.5.3" + "source": "https://github.com/composer/spdx-licenses/tree/1.5.4" }, - "time": "2020-02-14T07:44:31+00:00" + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2020-07-15T15:35:07+00:00" }, { "name": "composer/xdebug-handler", @@ -519,16 +533,16 @@ }, { "name": "seld/phar-utils", - "version": "1.1.0", + "version": "1.1.1", "source": { "type": "git", "url": "https://github.com/Seldaek/phar-utils.git", - "reference": "8800503d56b9867d43d9c303b9cbcc26016e82f0" + "reference": "8674b1d84ffb47cc59a101f5d5a3b61e87d23796" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/phar-utils/zipball/8800503d56b9867d43d9c303b9cbcc26016e82f0", - "reference": "8800503d56b9867d43d9c303b9cbcc26016e82f0", + "url": "https://api.github.com/repos/Seldaek/phar-utils/zipball/8674b1d84ffb47cc59a101f5d5a3b61e87d23796", + "reference": "8674b1d84ffb47cc59a101f5d5a3b61e87d23796", "shasum": "" }, "require": { @@ -561,9 +575,9 @@ ], "support": { "issues": "https://github.com/Seldaek/phar-utils/issues", - "source": "https://github.com/Seldaek/phar-utils/tree/1.1.0" + "source": "https://github.com/Seldaek/phar-utils/tree/master" }, - "time": "2020-02-14T15:25:33+00:00" + "time": "2020-07-07T18:42:57+00:00" }, { "name": "symfony/console", @@ -796,16 +810,16 @@ }, { "name": "symfony/polyfill-ctype", - "version": "v1.17.0", + "version": "v1.18.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "e94c8b1bbe2bc77507a1056cdb06451c75b427f9" + "reference": "1c302646f6efc070cd46856e600e5e0684d6b454" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e94c8b1bbe2bc77507a1056cdb06451c75b427f9", - "reference": "e94c8b1bbe2bc77507a1056cdb06451c75b427f9", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/1c302646f6efc070cd46856e600e5e0684d6b454", + "reference": "1c302646f6efc070cd46856e600e5e0684d6b454", "shasum": "" }, "require": { @@ -817,7 +831,11 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.17-dev" + "dev-master": "1.18-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { @@ -851,7 +869,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.17.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.18.0" }, "funding": [ { @@ -867,20 +885,20 @@ "type": "tidelift" } ], - "time": "2020-05-12T16:14:59+00:00" + "time": "2020-07-14T12:35:20+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.17.0", + "version": "v1.18.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "fa79b11539418b02fc5e1897267673ba2c19419c" + "reference": "a6977d63bf9a0ad4c65cd352709e230876f9904a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/fa79b11539418b02fc5e1897267673ba2c19419c", - "reference": "fa79b11539418b02fc5e1897267673ba2c19419c", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/a6977d63bf9a0ad4c65cd352709e230876f9904a", + "reference": "a6977d63bf9a0ad4c65cd352709e230876f9904a", "shasum": "" }, "require": { @@ -892,7 +910,11 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.17-dev" + "dev-master": "1.18-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { @@ -927,7 +949,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.17.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/master" }, "funding": [ { @@ -943,7 +965,7 @@ "type": "tidelift" } ], - "time": "2020-05-12T16:47:27+00:00" + "time": "2020-07-14T12:35:20+00:00" }, { "name": "symfony/process", diff --git a/src/Composer/Command/CreateProjectCommand.php b/src/Composer/Command/CreateProjectCommand.php index ddebbac8c..f7369e28e 100644 --- a/src/Composer/Command/CreateProjectCommand.php +++ b/src/Composer/Command/CreateProjectCommand.php @@ -41,6 +41,7 @@ use Composer\Util\Filesystem; use Composer\Util\ProcessExecutor; use Composer\Util\Loop; use Composer\Package\Version\VersionParser; +use Composer\EventDispatcher\EventDispatcher; /** * Install a package as new project into new directory. @@ -351,9 +352,13 @@ EOT throw new \InvalidArgumentException('Invalid stability provided ('.$stability.'), must be one of: '.implode(', ', array_keys(BasePackage::$stabilities))); } + $composer = Factory::create($io, $config->all(), $disablePlugins); + $config = $composer->getConfig(); + $rm = $composer->getRepositoryManager(); + $repositorySet = new RepositorySet($stability); if (null === $repositories) { - $repositorySet->addRepository(new CompositeRepository(RepositoryFactory::defaultRepos($io, $config))); + $repositorySet->addRepository(new CompositeRepository(RepositoryFactory::defaultRepos($io, $config, $rm))); } else { foreach ($repositories as $repo) { $repoConfig = RepositoryFactory::configFromString($io, $config, $repo, true); @@ -363,7 +368,7 @@ EOT ) { continue; } - $repositorySet->addRepository(RepositoryFactory::createRepo($io, $config, $repoConfig)); + $repositorySet->addRepository(RepositoryFactory::createRepo($io, $config, $repoConfig, $rm)); } } @@ -422,15 +427,12 @@ EOT $package = $package->getAliasOf(); } - $factory = new Factory(); - - $httpDownloader = $factory->createHttpDownloader($io, $config); - $dm = $factory->createDownloadManager($io, $config, $httpDownloader, $process); + $dm = $composer->getDownloadManager(); $dm->setPreferSource($preferSource) ->setPreferDist($preferDist); $projectInstaller = new ProjectInstaller($directory, $dm, $fs); - $im = $factory->createInstallationManager(new Loop($httpDownloader, $process), $io); + $im = $composer->getInstallationManager(); $im->setOutputProgress(!$noProgress); $im->addInstaller($projectInstaller); $im->execute(new InstalledFilesystemRepository(new JsonFile('php://memory')), array(new InstallOperation($package))); diff --git a/src/Composer/Command/SelfUpdateCommand.php b/src/Composer/Command/SelfUpdateCommand.php index 2e1d37d43..d79d22df2 100644 --- a/src/Composer/Command/SelfUpdateCommand.php +++ b/src/Composer/Command/SelfUpdateCommand.php @@ -380,8 +380,8 @@ TAGSPUBKEY // see if we can run this operation as an Admin on Windows if (!is_writable(dirname($localFilename)) && $io->isInteractive() - && $this->isWindowsNonAdminUser($isCygwin)) { - return $this->tryAsWindowsAdmin($localFilename, $newFilename, $isCygwin); + && $this->isWindowsNonAdminUser()) { + return $this->tryAsWindowsAdmin($localFilename, $newFilename); } $action = 'Composer '.($backupTarget ? 'update' : 'rollback'); @@ -467,20 +467,16 @@ TAGSPUBKEY /** * Returns true if this is a non-admin Windows user account * - * @param null|bool $isCygwin Set by method * @return bool */ - protected function isWindowsNonAdminUser(&$isCygwin) + protected function isWindowsNonAdminUser() { - $isCygwin = preg_match('/cygwin/i', php_uname()); - - if (!$isCygwin && !Platform::isWindows()) { + if (!Platform::isWindows()) { return false; } // fltmc.exe manages filter drivers and errors without admin privileges - $command = sprintf('%sfltmc.exe filters', $isCygwin ? 'cmd.exe /c ' : ''); - exec($command, $output, $exitCode); + exec('fltmc.exe filters', $output, $exitCode); return $exitCode !== 0; } @@ -492,10 +488,9 @@ TAGSPUBKEY * * @param string $localFilename The composer.phar location * @param string $newFilename The downloaded or backup phar - * @param bool $isCygwin Whether we are running on Cygwin * @return bool Whether composer.phar has been updated */ - protected function tryAsWindowsAdmin($localFilename, $newFilename, $isCygwin) + protected function tryAsWindowsAdmin($localFilename, $newFilename) { $io = $this->getIO(); @@ -515,15 +510,9 @@ TAGSPUBKEY $checksum = hash_file('sha256', $newFilename); - // format the file names for cmd.exe - if ($isCygwin) { - $source = exec(sprintf("cygpath -w '%s'", $newFilename)); - $destination = exec(sprintf("cygpath -w '%s'", $localFilename)); - } else { - // cmd's internal move is fussy about backslashes - $source = str_replace('/', '\\', $newFilename); - $destination = str_replace('/', '\\', $localFilename); - } + // cmd's internal move is fussy about backslashes + $source = str_replace('/', '\\', $newFilename); + $destination = str_replace('/', '\\', $localFilename); $vbs = <<