Merge pull request #4921 from curry684/bc-cleanup

BC cleanup
main
Jordi Boggiano 8 years ago
commit aea6045668

@ -104,6 +104,9 @@ EOT
$this->updatePreferredOptions($config, $input, $preferSource, $preferDist, true);
if ($input->getOption('dev')) {
$io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
}
if ($input->getOption('no-custom-installers')) {
$io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
$input->setOption('no-plugins', true);

@ -62,16 +62,6 @@ class DefaultPolicy implements PolicyInterface
return $pool->getPriority($package->getRepository());
}
/**
* @deprecated Method has been renamed to selectPreferredPackages, you should update usages
*/
public function selectPreferedPackages(Pool $pool, array $installedMap, array $literals, $requiredPackage = null)
{
trigger_error('Method selectPreferedPackages is deprecated and replaced by selectPreferredPackages, please update your usage', E_USER_DEPRECATED);
return $this->selectPreferredPackages($pool, $installedMap, $literals, $requiredPackage);
}
public function selectPreferredPackages(Pool $pool, array $installedMap, array $literals, $requiredPackage = null)
{
$packages = $this->groupLiteralsByNamePreferInstalled($pool, $installedMap, $literals);

@ -147,14 +147,6 @@ class Rule
return !(($this->bitfield & (255 << self::BITFIELD_DISABLED)) >> self::BITFIELD_DISABLED);
}
/**
* @deprecated Use public literals member
*/
public function getLiterals()
{
return $this->literals;
}
public function isAssertion()
{
return 1 === count($this->literals);

@ -175,21 +175,6 @@ class Installer
$this->mockLocalRepositories($this->repositoryManager);
}
// TODO remove this BC feature at some point
// purge old require-dev packages to avoid conflicts with the new way of handling dev requirements
$devRepo = new InstalledFilesystemRepository(new JsonFile($this->config->get('vendor-dir').'/composer/installed_dev.json'));
if ($devRepo->getPackages()) {
$this->io->writeError('<warning>BC Notice: Removing old dev packages to migrate to the new require-dev handling.</warning>');
foreach ($devRepo->getPackages() as $package) {
if ($this->installationManager->isPackageInstalled($devRepo, $package)) {
$this->installationManager->uninstall($devRepo, new UninstallOperation($package));
}
}
unlink($this->config->get('vendor-dir').'/composer/installed_dev.json');
}
unset($devRepo, $package);
// end BC
if ($this->runScripts) {
// dispatch pre event
$eventName = $this->update ? ScriptEvents::PRE_UPDATE_CMD : ScriptEvents::PRE_INSTALL_CMD;

@ -153,7 +153,7 @@ class LibraryInstaller implements InstallerInterface
/**
* Returns the base path of the package without target-dir path
*
* It is used for BC as getInstallPath tends to be overriden by
* It is used for BC as getInstallPath tends to be overridden by
* installer plugins but not getPackageBasePath
*
* @param PackageInterface $package

@ -236,13 +236,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
return array_keys($this->providerListing);
}
// BC handling for old providers-includes
$providers = array();
foreach (array_keys($this->providerListing) as $provider) {
$providers[] = substr($provider, 2, -5);
}
return $providers;
return array();
}
protected function configurePackageTransportOptions(PackageInterface $package)
@ -304,15 +298,7 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
$url = str_replace(array('%package%', '%hash%'), array($name, $hash), $this->providersUrl);
$cacheKey = 'provider-'.strtr($name, '/', '$').'.json';
} else {
// BC handling for old providers-includes
$url = 'p/'.$name.'.json';
// package does not exist in this repo
if (!isset($this->providerListing[$url])) {
return array();
}
$hash = $this->providerListing[$url]['sha256'];
$cacheKey = null;
return array();
}
$packages = null;
@ -459,9 +445,6 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
if (!empty($data['notify-batch'])) {
$this->notifyUrl = $this->canonicalizeUrl($data['notify-batch']);
} elseif (!empty($data['notify_batch'])) {
// TODO remove this BC notify_batch support
$this->notifyUrl = $this->canonicalizeUrl($data['notify_batch']);
} elseif (!empty($data['notify'])) {
$this->notifyUrl = $this->canonicalizeUrl($data['notify']);
}
@ -557,18 +540,6 @@ class ComposerRepository extends ArrayRepository implements ConfigurableReposito
$includedData = $this->fetchFile($url, $cacheKey, $metadata['sha256']);
}
$this->loadProviderListings($includedData);
}
} elseif (isset($data['providers-includes'])) {
// BC layer for old-style providers-includes
$includes = $data['providers-includes'];
foreach ($includes as $include => $metadata) {
if ($this->cache->sha256($include) === $metadata['sha256']) {
$includedData = json_decode($this->cache->read($include), true);
} else {
$includedData = $this->fetchFile($include, null, $metadata['sha256']);
}
$this->loadProviderListings($includedData);
}
}

@ -154,17 +154,4 @@ class RepositoryManager
{
return $this->localRepository;
}
/**
* Returns all local repositories for the project.
*
* @deprecated getLocalDevRepository is gone, so this is useless now, just use getLocalRepository instead
* @return array[WritableRepositoryInterface]
*/
public function getLocalRepositories()
{
trigger_error('This method is deprecated, use getLocalRepository instead since the getLocalDevRepository is now gone', E_USER_DEPRECATED);
return array($this->localRepository);
}
}

@ -110,7 +110,8 @@ class ComposerRepositoryTest extends TestCase
$properties = array(
'cache' => $cache,
'loader' => new ArrayLoader(),
'providerListing' => array('p/a.json' => array('sha256' => 'xxx')),
'providerListing' => array('a' => array('sha256' => 'xxx')),
'providersUrl' => 'https://dummy.test.link/to/%package%/file',
);
foreach ($properties as $property => $value) {

Loading…
Cancel
Save