cleanup site_functions.py
* remove useless distro check
This commit is contained in:
2
install
2
install
@@ -7,7 +7,7 @@
|
|||||||
# Copyright (c) 2019 - WordOps
|
# Copyright (c) 2019 - WordOps
|
||||||
# This script is licensed under M.I.T
|
# This script is licensed under M.I.T
|
||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
# Version 3.9.3 - 2019-03-05
|
# Version 3.9.3 - 2019-03-11
|
||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
readonly wo_version_old="2.2.3"
|
readonly wo_version_old="2.2.3"
|
||||||
readonly wo_version_new="3.9.3.1"
|
readonly wo_version_new="3.9.3.1"
|
||||||
|
|||||||
@@ -934,8 +934,8 @@ class WOSiteUpdateController(CementBaseController):
|
|||||||
Log.info(self, Log.FAIL + "Can not update HTML site to HHVM")
|
Log.info(self, Log.FAIL + "Can not update HTML site to HHVM")
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
if ((stype == 'php' and oldsitetype not in ['html', 'proxy', 'php73']) or
|
if ((stype == 'php' and
|
||||||
# (stype == 'php73' and oldsitetype not in ['html', 'mysql', 'php', 'php73', 'wp', 'wpsubdir', 'wpsubdomain', ]) or
|
oldsitetype not in ['html', 'proxy', 'php73']) or
|
||||||
(stype == 'mysql' and oldsitetype not in ['html', 'php',
|
(stype == 'mysql' and oldsitetype not in ['html', 'php',
|
||||||
'proxy', 'php73']) or
|
'proxy', 'php73']) or
|
||||||
(stype == 'wp' and oldsitetype not in ['html', 'php', 'mysql',
|
(stype == 'wp' and oldsitetype not in ['html', 'php', 'mysql',
|
||||||
|
|||||||
@@ -696,9 +696,11 @@ def site_package_check(self, stype):
|
|||||||
# apt_packages = apt_packages + WOVariables.wo_nginx
|
# apt_packages = apt_packages + WOVariables.wo_nginx
|
||||||
stack.post_pref(apt, packages)
|
stack.post_pref(apt, packages)
|
||||||
elif WOAptGet.is_installed(self, 'nginx'):
|
elif WOAptGet.is_installed(self, 'nginx'):
|
||||||
Log.info(self, "WordOps detected a previously installed Nginx package. "
|
Log.info(self, "WordOps detected a previously"
|
||||||
"It may or may not have required modules. "
|
"installed Nginx package. "
|
||||||
"\nIf you need help, please create an issue at https://github.com/WordOps/WordOps/issues/ \n")
|
"It may or may not have required modules. "
|
||||||
|
"\nIf you need help, please create an issue at "
|
||||||
|
"https://github.com/WordOps/WordOps/issues/ \n")
|
||||||
apt = ["nginx"] + WOVariables.wo_nginx
|
apt = ["nginx"] + WOVariables.wo_nginx
|
||||||
# apt_packages = apt_packages + WOVariables.wo_nginx
|
# apt_packages = apt_packages + WOVariables.wo_nginx
|
||||||
stack.post_pref(apt, packages)
|
stack.post_pref(apt, packages)
|
||||||
@@ -715,10 +717,11 @@ def site_package_check(self, stype):
|
|||||||
|
|
||||||
if self.app.pargs.php and self.app.pargs.php73:
|
if self.app.pargs.php and self.app.pargs.php73:
|
||||||
Log.error(
|
Log.error(
|
||||||
self, "Error: two different PHP versions cannot be combined within the same WordOps site")
|
self, "Error: two different PHP versions cannot be "
|
||||||
|
"combined within the same WordOps site")
|
||||||
|
|
||||||
if not self.app.pargs.php73 and stype in ['php', 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']:
|
if not self.app.pargs.php73 and stype in ['php', 'mysql', 'wp', 'wpsubdir', 'wpsubdomain']:
|
||||||
if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'):
|
if WOVariables.wo_platform_distro == 'ubuntu':
|
||||||
Log.debug(self, "Setting apt_packages variable for PHP 7.2")
|
Log.debug(self, "Setting apt_packages variable for PHP 7.2")
|
||||||
if not WOAptGet.is_installed(self, 'php7.2-fpm'):
|
if not WOAptGet.is_installed(self, 'php7.2-fpm'):
|
||||||
apt_packages = apt_packages + WOVariables.wo_php + WOVariables.wo_php_extra
|
apt_packages = apt_packages + WOVariables.wo_php + WOVariables.wo_php_extra
|
||||||
@@ -728,14 +731,9 @@ def site_package_check(self, stype):
|
|||||||
apt_packages = apt_packages + WOVariables.wo_php
|
apt_packages = apt_packages + WOVariables.wo_php
|
||||||
|
|
||||||
if self.app.pargs.php73 and stype in ['mysql', 'wp', 'wpsubdir', 'wpsubdomain']:
|
if self.app.pargs.php73 and stype in ['mysql', 'wp', 'wpsubdir', 'wpsubdomain']:
|
||||||
if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'):
|
Log.debug(self, "Setting apt_packages variable for PHP 7.3")
|
||||||
Log.debug(self, "Setting apt_packages variable for PHP 7.3")
|
if not WOAptGet.is_installed(self, 'php7.3-fpm'):
|
||||||
if not WOAptGet.is_installed(self, 'php7.3-fpm'):
|
apt_packages = apt_packages + WOVariables.wo_php73
|
||||||
apt_packages = apt_packages + WOVariables.wo_php73
|
|
||||||
else:
|
|
||||||
Log.debug(self, "Setting apt_packages variable for PHP 7.3")
|
|
||||||
if not WOAptGet.is_installed(self, 'php7.3-fpm'):
|
|
||||||
apt_packages = apt_packages + WOVariables.wo_php73
|
|
||||||
|
|
||||||
if stype in ['mysql', 'wp', 'wpsubdir', 'wpsubdomain']:
|
if stype in ['mysql', 'wp', 'wpsubdir', 'wpsubdomain']:
|
||||||
Log.debug(self, "Setting apt_packages variable for MySQL")
|
Log.debug(self, "Setting apt_packages variable for MySQL")
|
||||||
@@ -797,8 +795,11 @@ def site_package_check(self, stype):
|
|||||||
os.path.isfile("/etc/nginx/conf.d/redis.conf")):
|
os.path.isfile("/etc/nginx/conf.d/redis.conf")):
|
||||||
with open("/etc/nginx/conf.d/redis.conf", "a") as redis_file:
|
with open("/etc/nginx/conf.d/redis.conf", "a") as redis_file:
|
||||||
redis_file.write("# Log format Settings\n"
|
redis_file.write("# Log format Settings\n"
|
||||||
"log_format rt_cache_redis '$remote_addr $upstream_response_time $srcache_fetch_status [$time_local] '\n"
|
"log_format rt_cache_redis '$remote_addr"
|
||||||
"'$http_host \"$request\" $status $body_bytes_sent '\n"
|
" $upstream_response_time "
|
||||||
|
"$srcache_fetch_status [$time_local] '\n"
|
||||||
|
"'$http_host \"$request\" $status"
|
||||||
|
" $body_bytes_sent '\n"
|
||||||
"'\"$http_referer\" \"$http_user_agent\"';\n")
|
"'\"$http_referer\" \"$http_user_agent\"';\n")
|
||||||
|
|
||||||
if self.app.pargs.hhvm:
|
if self.app.pargs.hhvm:
|
||||||
@@ -843,14 +844,9 @@ def site_package_check(self, stype):
|
|||||||
"server 127.0.0.1:9000 backup;\n}\n")
|
"server 127.0.0.1:9000 backup;\n}\n")
|
||||||
|
|
||||||
if self.app.pargs.php73:
|
if self.app.pargs.php73:
|
||||||
if (WOVariables.wo_platform_codename == 'trusty' or WOVariables.wo_platform_codename == 'xenial' or WOVariables.wo_platform_codename == 'bionic'):
|
Log.debug(self, "Setting apt_packages variable for PHP 7.3")
|
||||||
Log.debug(self, "Setting apt_packages variable for PHP 7.3")
|
if not WOAptGet.is_installed(self, 'php7.3-fpm'):
|
||||||
if not WOAptGet.is_installed(self, 'php7.3-fpm'):
|
apt_packages = apt_packages + WOVariables.wo_php73
|
||||||
apt_packages = apt_packages + WOVariables.wo_php73
|
|
||||||
else:
|
|
||||||
Log.debug(self, "Setting apt_packages variable for PHP 7.3")
|
|
||||||
if not WOAptGet.is_installed(self, 'php7.3-fpm'):
|
|
||||||
apt_packages = apt_packages + WOVariables.wo_php73
|
|
||||||
|
|
||||||
if os.path.isdir("/etc/nginx/common") and (not
|
if os.path.isdir("/etc/nginx/common") and (not
|
||||||
os.path.isfile("/etc/nginx/common/php73.conf")):
|
os.path.isfile("/etc/nginx/common/php73.conf")):
|
||||||
@@ -910,8 +906,10 @@ def site_package_check(self, stype):
|
|||||||
if not WOFileUtils.grep(self, "/etc/nginx/conf.d/upstream.conf",
|
if not WOFileUtils.grep(self, "/etc/nginx/conf.d/upstream.conf",
|
||||||
"php73"):
|
"php73"):
|
||||||
with open("/etc/nginx/conf.d/upstream.conf", "a") as php_file:
|
with open("/etc/nginx/conf.d/upstream.conf", "a") as php_file:
|
||||||
php_file.write("upstream php73 {\nserver unix:/var/run/php/php73-fpm.sock;\n}\n"
|
php_file.write("upstream php73 {\nserver"
|
||||||
"upstream debug73 {\nserver 127.0.0.1:9173;\n}\n")
|
"unix:/var/run/php/php73-fpm.sock;\n}\n"
|
||||||
|
"upstream debug73"
|
||||||
|
" {\nserver 127.0.0.1:9173;\n}\n")
|
||||||
|
|
||||||
return(stack.install(apt_packages=apt_packages, packages=packages,
|
return(stack.install(apt_packages=apt_packages, packages=packages,
|
||||||
disp_msg=False))
|
disp_msg=False))
|
||||||
@@ -1055,7 +1053,8 @@ def detSitePar(opts):
|
|||||||
if len(typelist) > 1 or len(cachelist) > 1:
|
if len(typelist) > 1 or len(cachelist) > 1:
|
||||||
if len(cachelist) > 1:
|
if len(cachelist) > 1:
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
"Could not determine cache type.Multiple cache parameter entered")
|
"Could not determine cache type."
|
||||||
|
"Multiple cache parameter entered")
|
||||||
elif False not in [x in ('php', 'mysql', 'html') for x in typelist]:
|
elif False not in [x in ('php', 'mysql', 'html') for x in typelist]:
|
||||||
sitetype = 'mysql'
|
sitetype = 'mysql'
|
||||||
if not cachelist:
|
if not cachelist:
|
||||||
|
|||||||
@@ -45,6 +45,12 @@ class WOVariables():
|
|||||||
# WordOps default webroot path
|
# WordOps default webroot path
|
||||||
wo_webroot = '/var/www/'
|
wo_webroot = '/var/www/'
|
||||||
|
|
||||||
|
# WordOps default renewal SSL certificates path
|
||||||
|
wo_ssl_archive = '/etc/letsencrypt/renewal'
|
||||||
|
|
||||||
|
# WordOps default live SSL certificates path
|
||||||
|
wo_ssl_live = '/etc/letsencrypt/live'
|
||||||
|
|
||||||
# PHP user
|
# PHP user
|
||||||
wo_php_user = 'www-data'
|
wo_php_user = 'www-data'
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user