-php-ver command

New command to change PHP version.
This commit is contained in:
Cristhian Martínez Ochoa 2017-12-20 21:43:34 -06:00
parent 628718159f
commit 4b606e1445
2 changed files with 23 additions and 2 deletions

View file

@ -2,7 +2,7 @@
# Site Manager Plugin (Create, delete and de/activate)
# Syntax: site <domain> <option> <argument>
# Options: -html, -php, -wp, -wpsubdir, -wpsubdom, -parked, -on, -off, -delete, -delete-all, -list, -nocache, -cache, -ssl-on, ssl-off
# Options: -html, -php, -mysql, -wp, -wpsubdir, -wpsubdom, -parked, -on, -off, -delete, -delete-all, -list, -nocache, -cache, -ssl-on, ssl-off
# Arguments: -cache, -root
# shopt is necessary for this kind !(html|22222) of patterns

View file

@ -2,7 +2,7 @@
# Server Stack Manager
# Syntax: stack <option> <arguments>
# Options: -html, -nginx, -php, -lemp, -mysql, -pma, -info, -purge-server-all, -web-tools
# Options: -html, -nginx, -php, -lemp, -mysql, -pma, -info, -purge-server-all, -web-tools, -php-ver
# Arguments: -purge, -notools, -noptim
source /opt/webinoly/lib/install
@ -398,6 +398,27 @@ elif [[ $opt == "-lemp" ]]; then
echo ""
elif [[ $opt == "-php-ver="* ]]; then
phpver=$(echo "${opt}" | cut -d'=' -f 2 -s)
if [[ -n $phpver && ($phpver == "7.2" || $phpver == "7.1" || $phpver == "7.0" || $phpver == "5.6") ]]; then
echo "${blu} New PHP version: '$phpver' ${end}"
if [[ $(conf_read php) == "true" && $(conf_read mysql-tool) == "true" ]]; then
sudo stack -php -purge
conf_write php-ver $phpver
sudo stack -php
sudo stack -pma
elif [[ $(conf_read php) == "true" && $(conf_read mysql-tool) != "true" ]]; then
sudo stack -php -purge
conf_write php-ver $phpver
sudo stack -php
elif [[ $(conf_read php) != "true" && $(conf_read mysql-tool) != "true" ]]; then
conf_write php-ver $phpver
echo "${gre} PHP is not already installed but new version will be installed next time! ${end}"
fi
else
echo "${red} Please, enter a valid PHP version!${end}"
fi
# Info & Purge-Server-All
elif [[ $opt == "-info" ]]; then
system_info