Add php version selection into wo.conf

* set PHP 7.3 as default php version
* update travis script
This commit is contained in:
VirtuBox 2020-01-28 12:47:00 +01:00
parent 47dbb65ed8
commit 65b950e5ac
Signed by: virtubox
GPG Key ID: 22EB296C97BAD476
5 changed files with 63 additions and 41 deletions

View File

@ -88,3 +88,8 @@ enable_plugin = true
### `wo.cli.plugins.example` or from the file path
### `/var/lib/wo/plugins/example.py`
enable_plugin = true
[php]
### Default PHP version
version = 7.3

View File

@ -49,7 +49,7 @@ done
echo -e "${CGREEN}#############################################${CEND}"
echo -e ' Simple site create '
echo -e "${CGREEN}#############################################${CEND}"
site_types='html php php73 php74 mysql wp wpfc wpsc wpredis wpce wprocket wpsubdomain wpsubdir ngxblocker'
site_types='html php php72 php73 php74 mysql wp wpfc wpsc wpredis wpce wprocket wpsubdomain wpsubdir ngxblocker'
for site in $site_types; do
echo -ne " Creating $site [..]\r"
if {
@ -67,36 +67,17 @@ done
echo
echo -e "${CGREEN}#############################################${CEND}"
echo
wo site info wp.net
wo site info php.net
echo
echo
wo site info php72.net
echo
echo
echo -e "${CGREEN}#############################################${CEND}"
echo -e ' wo site update --php73 '
echo -e "${CGREEN}#############################################${CEND}"
other_site_types='html mysql php php74 wp wpfc wpsc wpredis wpce wprocket wpsubdomain wpsubdir ngxblocker'
for site in $other_site_types; do
echo -ne " Updating site to $site php73 [..]\r"
if {
wo site update ${site}.net --php73
} >>/var/log/wo/test.log; then
echo -ne " Updating site to $site php73 [${CGREEN}OK${CEND}]\\r"
echo -ne '\n'
else
echo -e " Updating site to $site php73 [${CRED}FAIL${CEND}]"
echo -ne '\n'
exit_script
fi
done
echo
echo -e "${CGREEN}#############################################${CEND}"
echo
wo site info wp.net
echo
echo -e "${CGREEN}#############################################${CEND}"
echo -e ' wo site update --php74 '
echo -e "${CGREEN}#############################################${CEND}"
other_site_types='html mysql wp php php73 wpfc wpsc wpredis wpce wprocket wpsubdomain wpsubdir ngxblocker'
other_site_types='html mysql php72 php74 wp wpfc wpsc wpredis wpce wprocket wpsubdomain wpsubdir ngxblocker'
for site in $other_site_types; do
echo -ne " Updating site to $site php74 [..]\r"
if {
@ -117,9 +98,32 @@ echo
wo site info wp.net
echo
echo -e "${CGREEN}#############################################${CEND}"
echo -e ' wo site update --php73 '
echo -e "${CGREEN}#############################################${CEND}"
other_site_types='html mysql wp php72 php73 wpfc wpsc wpredis wpce wprocket wpsubdomain wpsubdir ngxblocker'
for site in $other_site_types; do
echo -ne " Updating site to $site php73 [..]\r"
if {
wo site update ${site}.net --php73
} >>/var/log/wo/test.log; then
echo -ne " Updating site to $site php73 [${CGREEN}OK${CEND}]\\r"
echo -ne '\n'
else
echo -e " Updating site to $site php73 [${CRED}FAIL${CEND}]"
echo -ne '\n'
exit_script
fi
done
echo
echo -e "${CGREEN}#############################################${CEND}"
echo
wo site info wp.net
echo
echo -e "${CGREEN}#############################################${CEND}"
echo -e ' wo site update --php72 '
echo -e "${CGREEN}#############################################${CEND}"
other_site_types='html mysql php php73 php74 wp wpfc wpsc wpredis wpce wprocket wpsubdomain wpsubdir ngxblocker'
other_site_types='html mysql php72 php73 php74 wp wpfc wpsc wpredis wpce wprocket wpsubdomain wpsubdir ngxblocker'
for site in $other_site_types; do
echo -ne " Updating site to $site php72 [..]\r"
if {

View File

@ -211,21 +211,35 @@ def default(self):
else:
pass
data['php73'] = False
data['php74'] = False
data['php72'] = False
if data and pargs.php73:
data['php73'] = True
data['php74'] = False
data['php72'] = False
data['wo_php'] = 'php73'
elif data and pargs.php74:
data['php72'] = False
data['php74'] = True
data['php73'] = False
data['wo_php'] = 'php74'
else:
data['php74'] = False
elif data and pargs.php72:
data['php72'] = True
data['php73'] = False
data['wo_php'] = 'php72'
else:
if self.app.config.has_section('php'):
config_php_ver = self.app.config.get(
'php', 'version')
if config_php_ver == '7.2':
data['php72'] = True
data['wo_php'] = 'php72'
elif config_php_ver == '7.3':
data['php73'] = True
data['wo_php'] = 'php73'
elif config_php_ver == '7.4':
data['php74'] = True
data['wo_php'] = 'php74'
else:
data['php73'] = True
data['wo_php'] = 'php73'
if ((not pargs.wpfc) and (not pargs.wpsc) and
(not pargs.wprocket) and
@ -288,12 +302,12 @@ def default(self):
" http://{0}".format(wo_domain))
return
if data['php73']:
php_version = "7.3"
if data['php72']:
php_version = "7.2"
elif data['php74']:
php_version = "7.4"
else:
php_version = "7.2"
php_version = "7.3"
addNewSite(self, wo_domain, stype, cache, wo_site_webroot,
php_version=php_version)

View File

@ -220,7 +220,6 @@ def doupdatesite(self, pargs):
Log.error(
self, "service nginx reload failed. "
"check issues with `nginx -t` command")
return 0
# setup ngxblocker
if (pargs.ngxblocker):
@ -244,7 +243,6 @@ def doupdatesite(self, pargs):
if not WOService.reload_service(self, 'nginx'):
Log.error(self, "service nginx reload failed. "
"check issues with `nginx -t` command")
return 0
# letsencryot rebew
if (pargs.letsencrypt == 'renew'):
@ -615,7 +613,7 @@ def doupdatesite(self, pargs):
if WOAcme.cert_check(self, wo_domain):
if SSL.archivedcertificatehandle(
self, wo_domain, acme_domains):
self, wo_domain, acme_domains):
letsencrypt = True
else:
if acme_subdomain:

View File

@ -158,6 +158,7 @@ def install(self, packages=[], apt_packages=[], disp_msg=True):
pargs.phpredisadmin = True
pargs.extplorer = True
pargs.cheat = True
pargs.nanorc = True
if pargs.security:
pargs.fail2ban = True
@ -178,7 +179,7 @@ def install(self, packages=[], apt_packages=[], disp_msg=True):
apt_packages = apt_packages + WOVar.wo_redis
else:
Log.info(self, "Redis already installed")
Log.debug(self, "Redis already installed")
# PHP 7.2
if pargs.php72: