Added php-selector support
This commit is contained in:
@@ -44,6 +44,7 @@ check_hestia_demo_mode
|
||||
# Reading user values
|
||||
source $USER_DATA/user.conf
|
||||
|
||||
|
||||
versions=$($BIN/v-list-sys-php plain)
|
||||
support=0
|
||||
for v in $versions; do
|
||||
@@ -57,27 +58,35 @@ if [ "$support" = 0 ]; then
|
||||
exit 2
|
||||
fi
|
||||
|
||||
# Create .bash_aliases is not exsists
|
||||
if [ ! -f "$FILE" ]; then
|
||||
if [ -f /etc/redhat-release ];then
|
||||
mkdir -p $HOMEDIR/$user/.bashrc.d
|
||||
chown -R $user:$user $HOMEDIR/$user/.bashrc.d
|
||||
if [ "$PHP_SELECTOR" == "yes" ]; then
|
||||
/usr/bin/hestiacp-php-admin set $user $version
|
||||
if grep -q "alias php='env php" "$FILE"; then
|
||||
sed -i "/alias php='env/d" $FILE
|
||||
fi
|
||||
touch $FILE
|
||||
chown $user:$user $FILE
|
||||
else
|
||||
|
||||
# Create .bash_aliases is not exsists
|
||||
if [ ! -f "$FILE" ]; then
|
||||
if [ -f /etc/redhat-release ];then
|
||||
mkdir -p $HOMEDIR/$user/.bashrc.d
|
||||
chown -R $user:$user $HOMEDIR/$user/.bashrc.d
|
||||
fi
|
||||
touch $FILE
|
||||
chown $user:$user $FILE
|
||||
fi
|
||||
|
||||
if grep -q "alias php='env php$version'" "$FILE"; then
|
||||
echo "PHP CLI Already defined"
|
||||
exit
|
||||
fi
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Action #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
sed -i "/alias php='env/d" $FILE
|
||||
echo "alias php='env php$version'" >> $FILE
|
||||
fi
|
||||
|
||||
if grep -q "alias php='env php$version'" "$FILE"; then
|
||||
echo "PHP CLI Already defined"
|
||||
exit
|
||||
fi
|
||||
|
||||
#----------------------------------------------------------#
|
||||
# Action #
|
||||
#----------------------------------------------------------#
|
||||
|
||||
sed -i "/alias php='env/d" $FILE
|
||||
echo "alias php='env php$version'" >> $FILE
|
||||
update_user_value "$user" '$PHPCLI' "$version"
|
||||
|
||||
#----------------------------------------------------------#
|
||||
|
||||
Reference in New Issue
Block a user