mirror of
https://github.com/shivammathur/setup-php.git
synced 2024-11-26 13:23:05 +07:00
Make all extension variables local
This commit is contained in:
parent
57f4a60e24
commit
256b466cc4
@ -94,7 +94,7 @@ self_hosted_setup() {
|
|||||||
|
|
||||||
# Function to test if extension is loaded.
|
# Function to test if extension is loaded.
|
||||||
check_extension() {
|
check_extension() {
|
||||||
extension=$1
|
local extension=$1
|
||||||
if [ "$extension" != "mysql" ]; then
|
if [ "$extension" != "mysql" ]; then
|
||||||
php -m | grep -i -q -w "$extension"
|
php -m | grep -i -q -w "$extension"
|
||||||
else
|
else
|
||||||
@ -146,7 +146,7 @@ get_extension_map() {
|
|||||||
|
|
||||||
# Function to enable extension dependencies which are also extensions.
|
# Function to enable extension dependencies which are also extensions.
|
||||||
enable_extension_dependencies() {
|
enable_extension_dependencies() {
|
||||||
extension=$1
|
local extension=$1
|
||||||
prefix=$2
|
prefix=$2
|
||||||
if ! [ -e /tmp/map.orig ]; then
|
if ! [ -e /tmp/map.orig ]; then
|
||||||
get_extension_map | sudo tee /tmp/map.orig >/dev/null
|
get_extension_map | sudo tee /tmp/map.orig >/dev/null
|
||||||
@ -167,7 +167,7 @@ disable_extension_dependents() {
|
|||||||
|
|
||||||
# Function to disable an extension.
|
# Function to disable an extension.
|
||||||
disable_extension() {
|
disable_extension() {
|
||||||
extension=$1
|
local extension=$1
|
||||||
if check_extension "$extension"; then
|
if check_extension "$extension"; then
|
||||||
if shared_extension "$extension"; then
|
if shared_extension "$extension"; then
|
||||||
disable_extension_helper "$extension" true
|
disable_extension_helper "$extension" true
|
||||||
@ -212,7 +212,7 @@ configure_pecl() {
|
|||||||
|
|
||||||
# Function to get the PECL version of an extension.
|
# Function to get the PECL version of an extension.
|
||||||
get_pecl_version() {
|
get_pecl_version() {
|
||||||
extension=$1
|
local extension=$1
|
||||||
stability="$(echo "$2" | grep -m 1 -Eio "(stable|alpha|beta|rc|snapshot|preview)")"
|
stability="$(echo "$2" | grep -m 1 -Eio "(stable|alpha|beta|rc|snapshot|preview)")"
|
||||||
pecl_rest='https://pecl.php.net/rest/r/'
|
pecl_rest='https://pecl.php.net/rest/r/'
|
||||||
response=$(get -s -n "" "$pecl_rest$extension"/allreleases.xml)
|
response=$(get -s -n "" "$pecl_rest$extension"/allreleases.xml)
|
||||||
@ -232,7 +232,7 @@ pecl_install() {
|
|||||||
|
|
||||||
# Function to install a specific version of PECL extension.
|
# Function to install a specific version of PECL extension.
|
||||||
add_pecl_extension() {
|
add_pecl_extension() {
|
||||||
extension=$1
|
local extension=$1
|
||||||
pecl_version=$2
|
pecl_version=$2
|
||||||
prefix=$3
|
prefix=$3
|
||||||
enable_extension "$extension" "$prefix"
|
enable_extension "$extension" "$prefix"
|
||||||
@ -251,7 +251,7 @@ add_pecl_extension() {
|
|||||||
|
|
||||||
# Function to setup pre-release extensions using PECL.
|
# Function to setup pre-release extensions using PECL.
|
||||||
add_unstable_extension() {
|
add_unstable_extension() {
|
||||||
extension=$1
|
local extension=$1
|
||||||
stability=$2
|
stability=$2
|
||||||
prefix=$3
|
prefix=$3
|
||||||
pecl_version=$(get_pecl_version "$extension" "$stability")
|
pecl_version=$(get_pecl_version "$extension" "$stability")
|
||||||
|
@ -66,7 +66,7 @@ add_brew_extension() {
|
|||||||
|
|
||||||
# Function to setup extensions.
|
# Function to setup extensions.
|
||||||
add_extension() {
|
add_extension() {
|
||||||
extension=$1
|
local extension=$1
|
||||||
prefix=$2
|
prefix=$2
|
||||||
enable_extension "$extension" "$prefix"
|
enable_extension "$extension" "$prefix"
|
||||||
if check_extension "$extension"; then
|
if check_extension "$extension"; then
|
||||||
|
@ -62,7 +62,7 @@ add_pdo_extension() {
|
|||||||
|
|
||||||
# Function to add extensions.
|
# Function to add extensions.
|
||||||
add_extension() {
|
add_extension() {
|
||||||
extension=$1
|
local extension=$1
|
||||||
prefix=$2
|
prefix=$2
|
||||||
enable_extension "$extension" "$prefix"
|
enable_extension "$extension" "$prefix"
|
||||||
if check_extension "$extension"; then
|
if check_extension "$extension"; then
|
||||||
|
Loading…
Reference in New Issue
Block a user