mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-22 03:41:06 +07:00
Make all extension variables local
This commit is contained in:
parent
ab12e42197
commit
2c5cb7a75e
@ -18,7 +18,7 @@ add_log() {
|
||||
|
||||
# Function to remove extensions
|
||||
remove_extension() {
|
||||
extension=$1
|
||||
local extension=$1
|
||||
sudo sed -Ei '' "/=(.*\/)?\"?$extension/d" "$ini_file"
|
||||
sudo rm -rf "$scan_dir"/*"$extension"* >/dev/null 2>&1
|
||||
sudo rm -rf "$ext_dir"/"$extension".so >/dev/null 2>&1
|
||||
@ -26,7 +26,7 @@ remove_extension() {
|
||||
|
||||
# Function to test if extension is loaded
|
||||
check_extension() {
|
||||
extension=$1
|
||||
local extension=$1
|
||||
if [ "$extension" != "mysql" ]; then
|
||||
php -m | grep -i -q -w "$extension"
|
||||
else
|
||||
@ -42,7 +42,7 @@ pecl_install() {
|
||||
|
||||
# Function to get the PECL version
|
||||
get_pecl_version() {
|
||||
extension=$1
|
||||
local extension=$1
|
||||
stability="$(echo "$2" | grep -m 1 -Eio "(alpha|beta|rc|snapshot|preview)")"
|
||||
pecl_rest='https://pecl.php.net/rest/r/'
|
||||
response=$(curl "${curl_opts[@]}" "$pecl_rest$extension"/allreleases.xml)
|
||||
@ -55,7 +55,7 @@ get_pecl_version() {
|
||||
|
||||
# Function to install a PECL version
|
||||
add_pecl_extension() {
|
||||
extension=$1
|
||||
local extension=$1
|
||||
pecl_version=$2
|
||||
prefix=$3
|
||||
if [[ $pecl_version =~ .*(alpha|beta|rc|snapshot|preview).* ]]; then
|
||||
@ -114,7 +114,7 @@ add_brew_extension() {
|
||||
|
||||
# Function to setup extensions
|
||||
add_extension() {
|
||||
extension=$1
|
||||
local extension=$1
|
||||
install_command=$2
|
||||
prefix=$3
|
||||
if ! check_extension "$extension" && [ -e "$ext_dir/$extension.so" ]; then
|
||||
@ -132,7 +132,7 @@ add_extension() {
|
||||
|
||||
# Function to pre-release extensions using PECL
|
||||
add_unstable_extension() {
|
||||
extension=$1
|
||||
local extension=$1
|
||||
stability=$2
|
||||
prefix=$3
|
||||
pecl_version=$(get_pecl_version "$extension" "$stability")
|
||||
|
@ -20,7 +20,7 @@ update_ppa() {
|
||||
|
||||
# Function to install phalcon
|
||||
install_phalcon() {
|
||||
extension=$1
|
||||
local extension=$1
|
||||
version=$2
|
||||
(update_ppa && sudo DEBIAN_FRONTEND=noninteractive apt-get install -y "php$version-psr" "php$version-$extension" >/dev/null 2>&1 && add_log "$tick" "$extension" "Installed and enabled") ||
|
||||
add_log "$cross" "$extension" "Could not install $extension on PHP $semver"
|
||||
|
@ -62,7 +62,7 @@ configure_pecl() {
|
||||
|
||||
# Function to get the PECL version
|
||||
get_pecl_version() {
|
||||
extension=$1
|
||||
local extension=$1
|
||||
stability="$(echo "$2" | grep -m 1 -Eio "(alpha|beta|rc|snapshot|preview)")"
|
||||
pecl_rest='https://pecl.php.net/rest/r/'
|
||||
response=$(curl "${curl_opts[@]}" "$pecl_rest$extension"/allreleases.xml)
|
||||
@ -89,7 +89,7 @@ enable_extension() {
|
||||
|
||||
# Function to test if extension is loaded
|
||||
check_extension() {
|
||||
extension=$1
|
||||
local extension=$1
|
||||
if [ "$extension" != "mysql" ]; then
|
||||
php -m | grep -i -q -w "$extension"
|
||||
else
|
||||
@ -99,7 +99,7 @@ check_extension() {
|
||||
|
||||
# Function to delete extensions
|
||||
delete_extension() {
|
||||
extension=$1
|
||||
local extension=$1
|
||||
sudo sed -Ei "/=(.*\/)?\"?$extension/d" "$ini_file"
|
||||
sudo sed -Ei "/=(.*\/)?\"?$extension/d" "$pecl_file"
|
||||
sudo rm -rf "$scan_dir"/*"$extension"* >/dev/null 2>&1
|
||||
@ -109,7 +109,7 @@ delete_extension() {
|
||||
|
||||
# Function to disable and delete extensions
|
||||
remove_extension() {
|
||||
extension=$1
|
||||
local extension=$1
|
||||
if [ -e /etc/php/"$version"/mods-available/"$extension".ini ]; then
|
||||
sudo phpdismod -v "$version" "$extension"
|
||||
fi
|
||||
@ -118,7 +118,7 @@ remove_extension() {
|
||||
|
||||
# Function to setup extensions
|
||||
add_extension() {
|
||||
extension=$1
|
||||
local extension=$1
|
||||
install_command=$2
|
||||
prefix=$3
|
||||
enable_extension "$extension" "$prefix"
|
||||
@ -135,7 +135,7 @@ add_extension() {
|
||||
|
||||
# Function to install a PECL version
|
||||
add_pecl_extension() {
|
||||
extension=$1
|
||||
local extension=$1
|
||||
pecl_version=$2
|
||||
prefix=$3
|
||||
configure_pecl
|
||||
@ -158,7 +158,7 @@ add_pecl_extension() {
|
||||
|
||||
# Function to pre-release extensions using PECL
|
||||
add_unstable_extension() {
|
||||
extension=$1
|
||||
local extension=$1
|
||||
stability=$2
|
||||
prefix=$3
|
||||
pecl_version=$(get_pecl_version "$extension" "$stability")
|
||||
|
Loading…
Reference in New Issue
Block a user