mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 20:01:06 +07:00
Do not add composer plugins to allow list for composer v1
This commit is contained in:
parent
cf5cd90b4c
commit
ce49f82dd8
@ -205,7 +205,7 @@ Function Add-ComposertoolHelper() {
|
||||
if(Test-Path $composer_lock) {
|
||||
Remove-Item -Path $composer_lock -Force
|
||||
}
|
||||
if(composer global show $prefix$tool -a 2>&1 | findstr '^type *: *composer-plugin') {
|
||||
if((composer global show $prefix$tool -a 2>&1 | findstr '^type *: *composer-plugin') -and ($composer_args -ne '')) {
|
||||
composer global config --no-plugins allow-plugins."$prefix$tool" true >$null 2>&1
|
||||
}
|
||||
composer global require $prefix$release $composer_args >$null 2>&1
|
||||
@ -215,7 +215,7 @@ Function Add-ComposertoolHelper() {
|
||||
$scoped_dir_suffix = (Get-FileHash -InputStream $release_stream -Algorithm sha256).Hash
|
||||
$scoped_dir = "$composer_bin\_tools\$tool-$scoped_dir_suffix"
|
||||
$unix_scoped_dir = $scoped_dir.replace('\', '/')
|
||||
if(composer show $prefix$tool -d $unix_scoped_dir -a 2>&1 | findstr '^type *: *composer-plugin') {
|
||||
if((composer show $prefix$tool -d $unix_scoped_dir -a 2>&1 | findstr '^type *: *composer-plugin') -and ($composer_args -ne '')) {
|
||||
composer config -d $unix_scoped_dir --no-plugins allow-plugins."$prefix$release" true >$null 2>&1
|
||||
}
|
||||
if(-not(Test-Path $scoped_dir)) {
|
||||
@ -252,6 +252,7 @@ Function Add-Composertool() {
|
||||
[string]
|
||||
$scope
|
||||
)
|
||||
$composer_args = ""
|
||||
if($composer_version.split('.')[0] -ne "1") {
|
||||
$composer_args = "--ignore-platform-req=ext-*"
|
||||
if($tool -match "prestissimo|composer-prefetcher") {
|
||||
|
@ -162,17 +162,17 @@ add_composertool_helper() {
|
||||
enable_extensions curl mbstring openssl
|
||||
if [ "$scope" = "global" ]; then
|
||||
sudo rm -f "$composer_lock" >/dev/null 2>&1 || true
|
||||
if composer global show "$prefix$tool" -a 2>&1 | grep -qE '^type *: *composer-plugin'; then
|
||||
if composer global show "$prefix$tool" -a 2>&1 | grep -qE '^type *: *composer-plugin' && [ -n "$composer_args" ]; then
|
||||
composer global config --no-plugins allow-plugins."$prefix$tool" true >/dev/null 2>&1
|
||||
fi
|
||||
composer global require "$prefix$release" "$composer_args" >/dev/null 2>&1
|
||||
composer global show "$prefix$tool" 2>&1 | grep -E ^versions | sudo tee /tmp/composer_show.log >/dev/null 2>&1
|
||||
composer global show "$prefix$tool" 2>&1 | grep -E ^versions | sudo tee /tmp/composer.log >/dev/null 2>&1
|
||||
else
|
||||
scoped_dir="$composer_bin/_tools/$tool-$(echo -n "$release" | shasum -a 256 | cut -d ' ' -f 1)"
|
||||
if ! [ -d "$scoped_dir" ]; then
|
||||
mkdir -p "$scoped_dir"
|
||||
echo '{}' | tee "$scoped_dir/composer.json" >/dev/null
|
||||
if composer show "$prefix$tool" -d "$scoped_dir" -a 2>&1 | grep -qE '^type *: *composer-plugin'; then
|
||||
if composer show "$prefix$tool" -d "$scoped_dir" -a 2>&1 | grep -qE '^type *: *composer-plugin' && [ -n "$composer_args" ]; then
|
||||
composer config -d "$scoped_dir" --no-plugins allow-plugins."$prefix$tool" true >/dev/null 2>&1
|
||||
fi
|
||||
composer require "$prefix$release" -d "$scoped_dir" "$composer_args" >/dev/null 2>&1
|
||||
@ -188,6 +188,7 @@ add_composertool() {
|
||||
release=$2
|
||||
prefix=$3
|
||||
scope=$4
|
||||
composer_args=
|
||||
composer_major_version=$(cut -d'.' -f 1 /tmp/composer_version)
|
||||
if [ "$composer_major_version" != "1" ]; then
|
||||
composer_args="--ignore-platform-req=ext-*"
|
||||
|
Loading…
Reference in New Issue
Block a user