Quotes, quotes everywhere
This commit is contained in:
parent
a5598ca74c
commit
ef2161c5f3
20
php-helper
20
php-helper
|
@ -43,9 +43,9 @@ remove_state() {
|
||||||
local sapi=$3
|
local sapi=$3
|
||||||
local modname=$4
|
local modname=$4
|
||||||
|
|
||||||
local state_dir="$(get_state_dir $version $sapi)"
|
local state_dir="$(get_state_dir "$version" "$sapi")"
|
||||||
rm -f "${state_dir}/${action}_by_admin/$modname"
|
rm -f "${state_dir}/${action}_by_admin/${modname}"
|
||||||
rm -f "${state_dir}/${action}_by_maint/$modname"
|
rm -f "${state_dir}/${action}_by_maint/${modname}"
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ mod_registry() {
|
||||||
local action=$1
|
local action=$1
|
||||||
local modname=$2
|
local modname=$2
|
||||||
local registry_dir="$(get_registry_dir)"
|
local registry_dir="$(get_registry_dir)"
|
||||||
local registry_file="$registry_dir/$modname"
|
local registry_file="${registry_dir}/${modname}"
|
||||||
|
|
||||||
case $action in
|
case $action in
|
||||||
register)
|
register)
|
||||||
|
@ -87,7 +87,7 @@ record_state() {
|
||||||
local sapi=$3
|
local sapi=$3
|
||||||
local modname=$4
|
local modname=$4
|
||||||
|
|
||||||
local state_dir="$(get_state_dir $version $sapi)"
|
local state_dir="$(get_state_dir "$version" $sapi)"
|
||||||
local admin_state="${state_dir}/${action}_by_admin/$modname"
|
local admin_state="${state_dir}/${action}_by_admin/$modname"
|
||||||
local maint_state="${state_dir}/${action}_by_maint/$modname"
|
local maint_state="${state_dir}/${action}_by_maint/$modname"
|
||||||
|
|
||||||
|
@ -104,8 +104,8 @@ record_state() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# cleanup previous state
|
# cleanup previous state
|
||||||
remove_state disabled $version $sapi $modname
|
remove_state disabled "$version" "$sapi" "$modname"
|
||||||
remove_state enabled $version $sapi $modname
|
remove_state enabled "$version" "$sapi" "$modname"
|
||||||
|
|
||||||
if [ "$MAINT_MODE" = "yes" ]; then
|
if [ "$MAINT_MODE" = "yes" ]; then
|
||||||
mkdir -p "$(dirname $maint_state)"
|
mkdir -p "$(dirname $maint_state)"
|
||||||
|
@ -132,12 +132,12 @@ get_priority() {
|
||||||
local source_ini="/etc/php/${version}/mods-available/${modname}.ini"
|
local source_ini="/etc/php/${version}/mods-available/${modname}.ini"
|
||||||
|
|
||||||
module_ret=0
|
module_ret=0
|
||||||
module_exists $version $modname || module_ret=$?
|
module_exists "$version" "$modname" || module_ret=$?
|
||||||
|
|
||||||
if [ "$module_ret" -eq 0 ]; then
|
if [ "$module_ret" -eq 0 ]; then
|
||||||
priority=$(sed -ne "s/^; ?priority=\([0-9]\+\)$/\\1/p" $source_ini)
|
priority=$(sed -ne "s/^; ?priority=\([0-9]\+\)$/\\1/p" "$source_ini")
|
||||||
[ -z "$priority" ] && priority=20
|
[ -z "$priority" ] && priority=20
|
||||||
echo $priority
|
echo "$priority"
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
56
phpenmod
56
phpenmod
|
@ -67,8 +67,8 @@ resolve_sapis() {
|
||||||
}
|
}
|
||||||
|
|
||||||
enmods() {
|
enmods() {
|
||||||
local _versions="$1"
|
local versions="$1"
|
||||||
local _sapis="$2"
|
local sapis="$2"
|
||||||
local mods="$3"
|
local mods="$3"
|
||||||
local register="$4"
|
local register="$4"
|
||||||
local versions
|
local versions
|
||||||
|
@ -79,19 +79,19 @@ enmods() {
|
||||||
|
|
||||||
for mod in $mods; do
|
for mod in $mods; do
|
||||||
for version in $(resolve_versions "$versions"); do
|
for version in $(resolve_versions "$versions"); do
|
||||||
for sapi in $(resolve_sapis $version "$sapis"); do
|
for sapi in $(resolve_sapis "$version" "$sapis"); do
|
||||||
enmod_ret=0
|
enmod_ret=0
|
||||||
enmod $version $sapi $mod || enmod_ret=$?
|
enmod "$version" "$sapi" "$mod" || enmod_ret=$?
|
||||||
case $enmod_ret in
|
case $enmod_ret in
|
||||||
0)
|
0)
|
||||||
NEED_RESTART=yes
|
NEED_RESTART=yes
|
||||||
record_state enabled $version $sapi $mod
|
record_state enabled "$version" "$sapi" "$mod"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
if [ "$register" = "yes" ]; then
|
if [ "$register" = "yes" ]; then
|
||||||
mod_registry register $mod
|
mod_registry register "$mod"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
@ -108,23 +108,23 @@ dismods() {
|
||||||
|
|
||||||
for mod in $mods; do
|
for mod in $mods; do
|
||||||
for version in $(resolve_versions "$versions"); do
|
for version in $(resolve_versions "$versions"); do
|
||||||
for sapi in $(resolve_sapis $version "$sapis"); do
|
for sapi in $(resolve_sapis "$version" "$sapis"); do
|
||||||
local dismod_ret=0
|
local dismod_ret=0
|
||||||
dismod $version $sapi $mod $purge || dismod_ret=$?
|
dismod "$version" "$sapi" "$mod" "$purge" || dismod_ret=$?
|
||||||
case $dismod_ret in
|
case $dismod_ret in
|
||||||
0)
|
0)
|
||||||
NEED_RESTART=yes
|
NEED_RESTART=yes
|
||||||
record_state disabled $version $sapi $mod
|
record_state disabled "$version" "$sapi" "$mod"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
if [ "$purge" = "yes" ]; then
|
if [ "$purge" = "yes" ]; then
|
||||||
remove_state enabled $sapi $mod
|
remove_state enabled "$sapi" "$mod"
|
||||||
remove_state disabled $sapi $mod
|
remove_state disabled "$sapi" "$mod"
|
||||||
mod_registry unregister $mod
|
mod_registry unregister "$mod"
|
||||||
elif [ "$register" = "yes" ]; then
|
elif [ "$register" = "yes" ]; then
|
||||||
mod_registry unregister $mod
|
mod_registry unregister "$mod"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
@ -134,19 +134,19 @@ enmod() {
|
||||||
local sapi=$2
|
local sapi=$2
|
||||||
local modname=$3
|
local modname=$3
|
||||||
|
|
||||||
if ! module_exists $version $modname; then
|
if ! module_exists "$version" "$modname"; then
|
||||||
warning "Module $modname ini file doesn't exist under /etc/php/${version}/mods-available"
|
warning "Module $modname ini file doesn't exist under /etc/php/${version}/mods-available"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local priority=$(get_priority $version $sapi $modname)
|
local priority=$(get_priority "$version" "$sapi" "$modname")
|
||||||
local live_link=$(get_live_link $version $sapi $modname $priority)
|
local live_link=$(get_live_link "$version" "$sapi" "$modname" "$priority")
|
||||||
local live_link_content=$(get_live_link_content $version $sapi $modname $priority)
|
local live_link_content=$(get_live_link_content "$version" "$sapi" "$modname" "$priority")
|
||||||
|
|
||||||
local module_state=0
|
local module_state=0
|
||||||
phpquery -q -v $version -s $sapi -m $modname || module_state=$?
|
phpquery -q -v "$version" -s "$sapi" -m "$modname" || module_state=$?
|
||||||
|
|
||||||
case $module_state in
|
case "$module_state" in
|
||||||
# module enabled, but re-enable the conf.d link just in case
|
# module enabled, but re-enable the conf.d link just in case
|
||||||
0)
|
0)
|
||||||
;;
|
;;
|
||||||
|
@ -172,7 +172,7 @@ enmod() {
|
||||||
;;
|
;;
|
||||||
# fail if we get any different result
|
# fail if we get any different result
|
||||||
*)
|
*)
|
||||||
warning "Unable to get module state, run phpquery -v $version -s $sapi -m $modname manually"
|
warning "Unable to get module state, run phpquery -v ${version} -s ${sapi} -m ${modname} manually"
|
||||||
warning "and fix the module state."
|
warning "and fix the module state."
|
||||||
return 1
|
return 1
|
||||||
esac
|
esac
|
||||||
|
@ -195,19 +195,19 @@ dismod() {
|
||||||
local modname=$3
|
local modname=$3
|
||||||
local purge=$4
|
local purge=$4
|
||||||
|
|
||||||
if ! module_exists $version $modname; then
|
if ! module_exists "$version" "$modname"; then
|
||||||
if [ "$purge" = "no" ]; then
|
if [ "$purge" = "no" ]; then
|
||||||
warning "Module $modname ini file doesn't exist under /etc/php/${version}/mods-available"
|
warning "Module ${modname} ini file doesn't exist under /etc/php/${version}/mods-available"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local priority=$(get_priority $version $sapi $modname)
|
local priority=$(get_priority "$version" "$sapi" "$modname")
|
||||||
local live_link=$(get_live_link $version $sapi $modname $priority)
|
local live_link=$(get_live_link "$version" "$sapi" "$modname" "$priority")
|
||||||
local live_link_content=$(get_live_link_content $version $sapi $modname $priority)
|
local live_link_content=$(get_live_link_content "$version" "$sapi" "$modname" "$priority")
|
||||||
|
|
||||||
local module_state=0
|
local module_state=0
|
||||||
phpquery -q -v $version -s $sapi -m $modname || module_state=$?
|
phpquery -q -v "$version" -s "$sapi" -m "$modname" || module_state=$?
|
||||||
|
|
||||||
case $module_state in
|
case $module_state in
|
||||||
# module enabled
|
# module enabled
|
||||||
|
@ -217,13 +217,13 @@ dismod() {
|
||||||
1|32|33)
|
1|32|33)
|
||||||
;;
|
;;
|
||||||
34)
|
34)
|
||||||
warning "Not disabling module $modname for $sapi SAPI. The configuration was"
|
warning "Not disabling module ${modname} for ${sapi} SAPI. The configuration was"
|
||||||
warning "modified by local administrator."
|
warning "modified by local administrator."
|
||||||
return 1
|
return 1
|
||||||
;;
|
;;
|
||||||
# fail if we get any different result
|
# fail if we get any different result
|
||||||
*)
|
*)
|
||||||
warning "Unable to get module state, run phpquery -v $version -s $sapi -m $modname manually"
|
warning "Unable to get module state, run phpquery -v ${version} -s ${sapi} -m ${modname} manually"
|
||||||
warning "and fix the module state."
|
warning "and fix the module state."
|
||||||
return 1
|
return 1
|
||||||
esac
|
esac
|
||||||
|
|
Loading…
Reference in a new issue