From 6bd872ad2cb6a52eb83c782dc21a1085cb436706 Mon Sep 17 00:00:00 2001 From: Shivam Mathur Date: Tue, 2 Jun 2020 13:29:06 +0530 Subject: [PATCH] Fix composer peer fingerprint error for old PHP --- src/scripts/darwin.sh | 4 ++++ src/scripts/linux.sh | 4 ++++ src/scripts/win32.ps1 | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/src/scripts/darwin.sh b/src/scripts/darwin.sh index 5b6dc8a8..8da47a8b 100644 --- a/src/scripts/darwin.sh +++ b/src/scripts/darwin.sh @@ -139,6 +139,10 @@ add_tool() { if [ -n "$COMPOSER_TOKEN" ]; then composer -q global config github-oauth.github.com "$COMPOSER_TOKEN" fi + # TODO: Remove after composer 2.0 update, fixes peer fingerprint error + if [[ "$version" =~ $old_versions ]]; then + composer -q global config repos.packagist composer https://repo-ca-bhs-1.packagist.org + fi elif [ "$tool" = "phan" ]; then add_extension fileinfo "sudo pecl install -f fileinfo" extension >/dev/null 2>&1 add_extension ast "sudo pecl install -f ast" extension >/dev/null 2>&1 diff --git a/src/scripts/linux.sh b/src/scripts/linux.sh index d95c556a..812e0fc8 100644 --- a/src/scripts/linux.sh +++ b/src/scripts/linux.sh @@ -220,6 +220,10 @@ add_tool() { if [ -n "$COMPOSER_TOKEN" ]; then composer -q global config github-oauth.github.com "$COMPOSER_TOKEN" fi + # TODO: Remove after composer 2.0 update, fixes peer fingerprint error + if [[ "$version" =~ $old_versions ]]; then + composer -q global config repos.packagist composer https://repo-ca-bhs-1.packagist.org + fi elif [ "$tool" = "cs2pr" ]; then sudo sed -i 's/\r$//; s/exit(9)/exit(0)/' "$tool_path" elif [ "$tool" = "phan" ]; then diff --git a/src/scripts/win32.ps1 b/src/scripts/win32.ps1 index ec51ccec..ae5fa200 100644 --- a/src/scripts/win32.ps1 +++ b/src/scripts/win32.ps1 @@ -186,6 +186,10 @@ Function Add-Tool() { if (Test-Path env:COMPOSER_TOKEN) { composer -q global config github-oauth.github.com $env:COMPOSER_TOKEN } + # TODO: Remove after composer 2.0 update, fixes peer fingerprint error + if ($version -lt 5.6) { + composer -q global config repos.packagist composer https://repo-ca-bhs-1.packagist.org + } } elseif($tool -eq "wp-cli") { Copy-Item $php_dir\wp-cli.bat -Destination $php_dir\wp.bat }