1
0
Fork 0

Auto-detect packagist.org default repo replacements and deactivate it if it is redefined

pull/9702/head
Jordi Boggiano 2021-02-11 10:41:17 +01:00
parent f37f3dab04
commit 4130d388fe
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
1 changed files with 5 additions and 2 deletions

View File

@ -78,8 +78,7 @@ class Config
public static $defaultRepositories = array( public static $defaultRepositories = array(
'packagist.org' => array( 'packagist.org' => array(
'type' => 'composer', 'type' => 'composer',
'url' => 'https?://repo.packagist.org', 'url' => 'https://repo.packagist.org',
'allow_ssl_downgrade' => true,
), ),
); );
@ -182,6 +181,10 @@ class Config
// store repo // store repo
if (is_int($name)) { if (is_int($name)) {
// auto-deactivate the default packagist.org repo if it gets redefined
if (isset($repository['type'], $repository['url']) && $repository['type'] === 'composer' && preg_match('{^https?://(?:[a-z0-9-.]+\.)?packagist.org(/|$)}', $repository['url'])) {
$this->disableRepoByName('packagist.org');
}
$this->repositories[] = $repository; $this->repositories[] = $repository;
} else { } else {
if ($name === 'packagist') { // BC support for default "packagist" named repo if ($name === 'packagist') { // BC support for default "packagist" named repo