mirror of
https://github.com/shivammathur/setup-php.git
synced 2025-09-08 05:44:07 +07:00
Add support for COMPOSER_ALLOW_PLUGINS
This commit is contained in:
@ -58,6 +58,11 @@ Function Set-ComposerEnv() {
|
||||
(Get-Content $src\configs\composer.env -Raw) -replace '(?m)^COMPOSER_PROCESS_TIMEOUT=.*$', "COMPOSER_PROCESS_TIMEOUT=$env:COMPOSER_PROCESS_TIMEOUT" | Set-Content $src\configs\composer.env
|
||||
}
|
||||
Add-EnvPATH $src\configs\composer.env
|
||||
if($env:COMPOSER_ALLOW_PLUGINS) {
|
||||
$env:COMPOSER_ALLOW_PLUGINS -split '\s*,\s*' | Where-Object { $_ } | ForEach-Object {
|
||||
& composer global config --no-plugins "allow-plugins.$_" true > $null 2>&1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Function to extract tool version.
|
||||
|
@ -75,6 +75,11 @@ set_composer_env() {
|
||||
sed -i "$sed_arg" "$composer_env" 2>/dev/null || sed -i '' "$sed_arg" "$composer_env"
|
||||
fi
|
||||
add_env_path "$composer_env"
|
||||
if [ -n "$COMPOSER_ALLOW_PLUGINS" ]; then
|
||||
echo "$COMPOSER_ALLOW_PLUGINS" | tr ',' '\n' | sed 's/^[[:space:]]*//;s/[[:space:]]*$//' | grep -v '^$' | while IFS= read -r plugin; do
|
||||
composer global config --no-plugins "allow-plugins.$plugin" true >/dev/null 2>&1
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
# Helper function to configure tools.
|
||||
|
Reference in New Issue
Block a user