fix wo info
This commit is contained in:
@@ -19,7 +19,8 @@ class WOCleanController(CementBaseController):
|
|||||||
label = 'clean'
|
label = 'clean'
|
||||||
stacked_on = 'base'
|
stacked_on = 'base'
|
||||||
stacked_type = 'nested'
|
stacked_type = 'nested'
|
||||||
description = ('Clean NGINX FastCGI cache, Opcache, Memcached, Redis Cache')
|
description = (
|
||||||
|
'Clean NGINX FastCGI cache, Opcache, Memcached, Redis Cache')
|
||||||
arguments = [
|
arguments = [
|
||||||
(['--all'],
|
(['--all'],
|
||||||
dict(help='Clean all cache', action='store_true')),
|
dict(help='Clean all cache', action='store_true')),
|
||||||
@@ -31,7 +32,7 @@ class WOCleanController(CementBaseController):
|
|||||||
dict(help='Clean OpCache', action='store_true')),
|
dict(help='Clean OpCache', action='store_true')),
|
||||||
(['--redis'],
|
(['--redis'],
|
||||||
dict(help='Clean Redis Cache', action='store_true')),
|
dict(help='Clean Redis Cache', action='store_true')),
|
||||||
]
|
]
|
||||||
usage = "wo clean [options]"
|
usage = "wo clean [options]"
|
||||||
|
|
||||||
@expose(hide=True)
|
@expose(hide=True)
|
||||||
@@ -90,13 +91,13 @@ class WOCleanController(CementBaseController):
|
|||||||
wp = urllib.request.urlopen(" https://127.0.0.1:22222/cache"
|
wp = urllib.request.urlopen(" https://127.0.0.1:22222/cache"
|
||||||
"/opcache/opgui.php?page=reset").read()
|
"/opcache/opgui.php?page=reset").read()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
Log.debug(self, "{0}".format(e))
|
Log.debug(self, "{0}".format(e))
|
||||||
Log.debug(self, "Unable hit url, "
|
Log.debug(self, "Unable hit url, "
|
||||||
" https://127.0.0.1:22222/cache/opcache/opgui.php?page=reset,"
|
" https://127.0.0.1:22222/cache/opcache/opgui.php?page=reset,"
|
||||||
" please check you have admin tools installed")
|
" please check you have admin tools installed")
|
||||||
Log.debug(self, "please check you have admin tools installed,"
|
Log.debug(self, "please check you have admin tools installed,"
|
||||||
" or install them with `wo stack install --admin`")
|
" or install them with `wo stack install --admin`")
|
||||||
Log.error(self, "Unable to clean opcache", False)
|
Log.error(self, "Unable to clean opcache", False)
|
||||||
|
|
||||||
|
|
||||||
def load(app):
|
def load(app):
|
||||||
|
|||||||
@@ -41,9 +41,9 @@ class WOInfoController(CementBaseController):
|
|||||||
@expose(hide=True)
|
@expose(hide=True)
|
||||||
def info_nginx(self):
|
def info_nginx(self):
|
||||||
"""Display Nginx information"""
|
"""Display Nginx information"""
|
||||||
version = os.popen("nginx -v 2>&1 | cut -d':' -f2 | cut -d' ' -f2 | "
|
version = os.popen("nginx -v 2 > &1 | awk - F '/' '{print $2}' | '"
|
||||||
"cut -d'/' -f2 | tr -d '\n'").read()
|
"awk -F ' ' '{print $1}'").read()
|
||||||
allow = os.popen("grep ^allow /etc/nginx/common/acl.conf | "
|
allow = os.popen("grep allow /etc/nginx/common/acl.conf | "
|
||||||
"cut -d' ' -f2 | cut -d';' -f1 | tr '\n' ' '").read()
|
"cut -d' ' -f2 | cut -d';' -f1 | tr '\n' ' '").read()
|
||||||
nc = NginxConfig()
|
nc = NginxConfig()
|
||||||
nc.loadf('/etc/nginx/nginx.conf')
|
nc.loadf('/etc/nginx/nginx.conf')
|
||||||
@@ -242,8 +242,8 @@ class WOInfoController(CementBaseController):
|
|||||||
@expose(hide=True)
|
@expose(hide=True)
|
||||||
def default(self):
|
def default(self):
|
||||||
"""default function for info"""
|
"""default function for info"""
|
||||||
if (not self.app.pargs.nginx and not self.app.pargs.php
|
if (not self.app.pargs.nginx and not self.app.pargs.php and
|
||||||
and not self.app.pargs.mysql and not self.app.pargs.php73):
|
not self.app.pargs.mysql and not self.app.pargs.php73):
|
||||||
self.app.pargs.nginx = True
|
self.app.pargs.nginx = True
|
||||||
self.app.pargs.php = True
|
self.app.pargs.php = True
|
||||||
self.app.pargs.mysql = True
|
self.app.pargs.mysql = True
|
||||||
@@ -251,7 +251,8 @@ class WOInfoController(CementBaseController):
|
|||||||
self.app.pargs.php73 = True
|
self.app.pargs.php73 = True
|
||||||
|
|
||||||
if self.app.pargs.nginx:
|
if self.app.pargs.nginx:
|
||||||
if WOAptGet.is_installed(self, 'nginx-custom') or WOAptGet.is_installed(self, 'nginx-common'):
|
if (WOAptGet.is_installed(self, 'nginx-custom') or
|
||||||
|
WOAptGet.is_installed(self, 'nginx-common')):
|
||||||
self.info_nginx()
|
self.info_nginx()
|
||||||
else:
|
else:
|
||||||
Log.error(self, "Nginx is not installed")
|
Log.error(self, "Nginx is not installed")
|
||||||
|
|||||||
@@ -196,20 +196,20 @@ class WOLogResetController(CementBaseController):
|
|||||||
if self.app.pargs.php:
|
if self.app.pargs.php:
|
||||||
self.app.pargs.nginx = True
|
self.app.pargs.nginx = True
|
||||||
|
|
||||||
if ((not self.app.pargs.nginx) and (not self.app.pargs.fpm)
|
if ((not self.app.pargs.nginx) and (not self.app.pargs.fpm) and
|
||||||
and (not self.app.pargs.mysql) and (not self.app.pargs.access)
|
(not self.app.pargs.mysql) and (not self.app.pargs.access) and
|
||||||
and (not self.app.pargs.wp) and (not self.app.pargs.site_name)
|
(not self.app.pargs.wp) and (not self.app.pargs.site_name) and
|
||||||
and (not self.app.pargs.slow_log_db)):
|
(not self.app.pargs.slow_log_db)):
|
||||||
self.app.pargs.nginx = True
|
self.app.pargs.nginx = True
|
||||||
self.app.pargs.fpm = True
|
self.app.pargs.fpm = True
|
||||||
self.app.pargs.mysql = True
|
self.app.pargs.mysql = True
|
||||||
self.app.pargs.access = True
|
self.app.pargs.access = True
|
||||||
self.app.pargs.slow_log_db = True
|
self.app.pargs.slow_log_db = True
|
||||||
|
|
||||||
if ((not self.app.pargs.nginx) and (not self.app.pargs.fpm)
|
if ((not self.app.pargs.nginx) and (not self.app.pargs.fpm) and
|
||||||
and (not self.app.pargs.mysql) and (not self.app.pargs.access)
|
(not self.app.pargs.mysql) and (not self.app.pargs.access) and
|
||||||
and (not self.app.pargs.wp) and (self.app.pargs.site_name)
|
(not self.app.pargs.wp) and (self.app.pargs.site_name) and
|
||||||
and (not self.app.pargs.slow-log-db)):
|
(not self.app.pargs.slow-log-db)):
|
||||||
self.app.pargs.nginx = True
|
self.app.pargs.nginx = True
|
||||||
self.app.pargs.wp = True
|
self.app.pargs.wp = True
|
||||||
self.app.pargs.access = True
|
self.app.pargs.access = True
|
||||||
@@ -335,17 +335,17 @@ class WOLogGzipController(CementBaseController):
|
|||||||
if self.app.pargs.php:
|
if self.app.pargs.php:
|
||||||
self.app.pargs.nginx = True
|
self.app.pargs.nginx = True
|
||||||
|
|
||||||
if ((not self.app.pargs.nginx) and (not self.app.pargs.fpm)
|
if ((not self.app.pargs.nginx) and (not self.app.pargs.fpm) and
|
||||||
and (not self.app.pargs.mysql) and (not self.app.pargs.access)
|
(not self.app.pargs.mysql) and (not self.app.pargs.access) and
|
||||||
and (not self.app.pargs.wp) and (not self.app.pargs.site_name)):
|
(not self.app.pargs.wp) and (not self.app.pargs.site_name)):
|
||||||
self.app.pargs.nginx = True
|
self.app.pargs.nginx = True
|
||||||
self.app.pargs.fpm = True
|
self.app.pargs.fpm = True
|
||||||
self.app.pargs.mysql = True
|
self.app.pargs.mysql = True
|
||||||
self.app.pargs.access = True
|
self.app.pargs.access = True
|
||||||
|
|
||||||
if ((not self.app.pargs.nginx) and (not self.app.pargs.fpm)
|
if ((not self.app.pargs.nginx) and (not self.app.pargs.fpm) and
|
||||||
and (not self.app.pargs.mysql) and (not self.app.pargs.access)
|
(not self.app.pargs.mysql) and (not self.app.pargs.access) and
|
||||||
and (not self.app.pargs.wp) and (self.app.pargs.site_name)):
|
(not self.app.pargs.wp) and (self.app.pargs.site_name)):
|
||||||
self.app.pargs.nginx = True
|
self.app.pargs.nginx = True
|
||||||
self.app.pargs.wp = True
|
self.app.pargs.wp = True
|
||||||
self.app.pargs.access = True
|
self.app.pargs.access = True
|
||||||
@@ -472,17 +472,17 @@ class WOLogMailController(CementBaseController):
|
|||||||
if self.app.pargs.php:
|
if self.app.pargs.php:
|
||||||
self.app.pargs.nginx = True
|
self.app.pargs.nginx = True
|
||||||
|
|
||||||
if ((not self.app.pargs.nginx) and (not self.app.pargs.fpm)
|
if ((not self.app.pargs.nginx) and (not self.app.pargs.fpm) and
|
||||||
and (not self.app.pargs.mysql) and (not self.app.pargs.access)
|
(not self.app.pargs.mysql) and (not self.app.pargs.access) and
|
||||||
and (not self.app.pargs.wp) and (not self.app.pargs.site_name)):
|
(not self.app.pargs.wp) and (not self.app.pargs.site_name)):
|
||||||
self.app.pargs.nginx = True
|
self.app.pargs.nginx = True
|
||||||
self.app.pargs.fpm = True
|
self.app.pargs.fpm = True
|
||||||
self.app.pargs.mysql = True
|
self.app.pargs.mysql = True
|
||||||
self.app.pargs.access = True
|
self.app.pargs.access = True
|
||||||
|
|
||||||
if ((not self.app.pargs.nginx) and (not self.app.pargs.fpm)
|
if ((not self.app.pargs.nginx) and (not self.app.pargs.fpm) and
|
||||||
and (not self.app.pargs.mysql) and (not self.app.pargs.access)
|
(not self.app.pargs.mysql) and (not self.app.pargs.access) and
|
||||||
and (not self.app.pargs.wp) and (self.app.pargs.site_name)):
|
(not self.app.pargs.wp) and (self.app.pargs.site_name)):
|
||||||
self.app.pargs.nginx = True
|
self.app.pargs.nginx = True
|
||||||
self.app.pargs.wp = True
|
self.app.pargs.wp = True
|
||||||
self.app.pargs.access = True
|
self.app.pargs.access = True
|
||||||
|
|||||||
@@ -1099,7 +1099,7 @@ class WOSiteUpdateController(CementBaseController):
|
|||||||
else:
|
else:
|
||||||
data['letsencrypt'] = True
|
data['letsencrypt'] = True
|
||||||
letsencrypt = True
|
letsencrypt = True
|
||||||
wildcard = True
|
wildcard = False
|
||||||
|
|
||||||
if pargs.wpredis and data['currcachetype'] != 'wpredis':
|
if pargs.wpredis and data['currcachetype'] != 'wpredis':
|
||||||
data['wpredis'] = True
|
data['wpredis'] = True
|
||||||
|
|||||||
@@ -1194,9 +1194,9 @@ def doCleanupAction(self, domain='', webroot='', dbname='', dbuser='',
|
|||||||
raise SiteError("dbhost not provided")
|
raise SiteError("dbhost not provided")
|
||||||
deleteDB(self, dbname, dbuser, dbhost)
|
deleteDB(self, dbname, dbuser, dbhost)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# setup letsencrypt for domain + www.domain
|
# setup letsencrypt for domain + www.domain
|
||||||
|
|
||||||
|
|
||||||
def setupLetsEncrypt(self, wo_domain_name):
|
def setupLetsEncrypt(self, wo_domain_name):
|
||||||
|
|
||||||
if os.path.isfile("/etc/letsencrypt/renewal/{0}_ecc/{0}.conf"
|
if os.path.isfile("/etc/letsencrypt/renewal/{0}_ecc/{0}.conf"
|
||||||
@@ -1450,16 +1450,16 @@ def archivedCertificateHandle(self, domain):
|
|||||||
"certificate for your site.\nIt may take a "
|
"certificate for your site.\nIt may take a "
|
||||||
"few minutes depending on your network.")
|
"few minutes depending on your network.")
|
||||||
ssl = WOShellExec.cmd_exec(self, "mkdir -p {0}/{1} && "
|
ssl = WOShellExec.cmd_exec(self, "mkdir -p {0}/{1} && "
|
||||||
"/etc/letsencrypt/acme.sh "
|
"/etc/letsencrypt/acme.sh "
|
||||||
"--config-home "
|
"--config-home "
|
||||||
"'/etc/letsencrypt/config' "
|
"'/etc/letsencrypt/config' "
|
||||||
"--install-cert -d {1} --ecc "
|
"--install-cert -d {1} --ecc "
|
||||||
"--cert-file {0}/{1}/cert.pem "
|
"--cert-file {0}/{1}/cert.pem "
|
||||||
"--key-file {0}/{1}/key.pem "
|
"--key-file {0}/{1}/key.pem "
|
||||||
"--fullchain-file "
|
"--fullchain-file "
|
||||||
"{0}/{1}/fullchain.pem "
|
"{0}/{1}/fullchain.pem "
|
||||||
"--reloadcmd "
|
"--reloadcmd "
|
||||||
"\"service nginx restart\" "
|
"\"service nginx restart\" "
|
||||||
.format(WOVariables.wo_ssl_live, domain))
|
.format(WOVariables.wo_ssl_live, domain))
|
||||||
if ssl:
|
if ssl:
|
||||||
|
|
||||||
@@ -1511,7 +1511,7 @@ def archivedCertificateHandle(self, domain):
|
|||||||
"--force"
|
"--force"
|
||||||
.format(domain))
|
.format(domain))
|
||||||
|
|
||||||
if issuessl:
|
if ssl:
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user