Fix phpMyAdmin folder removal and letsencrypt clean/purge
This commit is contained in:
@@ -820,7 +820,7 @@ class WOSiteUpdateController(CementBaseController):
|
|||||||
dict(help="configure letsencrypt ssl for the site",
|
dict(help="configure letsencrypt ssl for the site",
|
||||||
action='store' or 'store_const',
|
action='store' or 'store_const',
|
||||||
choices=('on', 'off', 'renew', 'subdomain',
|
choices=('on', 'off', 'renew', 'subdomain',
|
||||||
'wildcard', 'clean'),
|
'wildcard', 'clean', 'purge'),
|
||||||
const='on', nargs='?')),
|
const='on', nargs='?')),
|
||||||
(['--dns'],
|
(['--dns'],
|
||||||
dict(help="choose dns provider api for letsencrypt",
|
dict(help="choose dns provider api for letsencrypt",
|
||||||
@@ -1186,6 +1186,9 @@ class WOSiteUpdateController(CementBaseController):
|
|||||||
elif pargs.letsencrypt == 'clean':
|
elif pargs.letsencrypt == 'clean':
|
||||||
data['letsencrypt'] = False
|
data['letsencrypt'] = False
|
||||||
letsencrypt = False
|
letsencrypt = False
|
||||||
|
elif pargs.letsencrypt == 'purge':
|
||||||
|
data['letsencrypt'] = False
|
||||||
|
letsencrypt = False
|
||||||
|
|
||||||
if letsencrypt is check_ssl:
|
if letsencrypt is check_ssl:
|
||||||
if letsencrypt is False:
|
if letsencrypt is False:
|
||||||
@@ -1214,13 +1217,16 @@ class WOSiteUpdateController(CementBaseController):
|
|||||||
|
|
||||||
if pargs.letsencrypt == "on":
|
if pargs.letsencrypt == "on":
|
||||||
if oldsitetype in ['wpsubdomain']:
|
if oldsitetype in ['wpsubdomain']:
|
||||||
data['letsencrypt'] = True
|
if pargs.dns:
|
||||||
letsencrypt = True
|
data['letsencrypt'] = True
|
||||||
pargs.letsencrypt == 'wildcard'
|
letsencrypt = True
|
||||||
|
pargs.letsencrypt == 'wildcard'
|
||||||
|
else:
|
||||||
|
data['letsencrypt'] = True
|
||||||
|
letsencrypt = True
|
||||||
else:
|
else:
|
||||||
data['letsencrypt'] = True
|
data['letsencrypt'] = True
|
||||||
letsencrypt = True
|
letsencrypt = True
|
||||||
wildcard = False
|
|
||||||
|
|
||||||
if pargs.wpredis and data['currcachetype'] != 'wpredis':
|
if pargs.wpredis and data['currcachetype'] != 'wpredis':
|
||||||
data['wpredis'] = True
|
data['wpredis'] = True
|
||||||
@@ -1345,16 +1351,9 @@ class WOSiteUpdateController(CementBaseController):
|
|||||||
'{0}/conf/nginx/'
|
'{0}/conf/nginx/'
|
||||||
'hsts.conf.disabled'
|
'hsts.conf.disabled'
|
||||||
.format(wo_site_webroot))
|
.format(wo_site_webroot))
|
||||||
if self.app.pargs.letsencrypt == "clean":
|
elif (self.app.pargs.letsencrypt == "clean" or
|
||||||
if os.path.isfile("{0}/conf/nginx/ssl.conf"
|
self.app.pargs.letsencrypt == "purge"):
|
||||||
.format(wo_site_webroot)):
|
removeAcmeConf(self, wo_domain)
|
||||||
WOFileUtils.remove(self, "{0}/conf/nginx/ssl.conf"
|
|
||||||
.format(wo_site_webroot))
|
|
||||||
WOFileUtils.remove(self, "/etc/letsencrypt/live"
|
|
||||||
"/{0}".format(wo_domain))
|
|
||||||
WOFileUtils.remove(self, "/etc/nginx/conf.d/"
|
|
||||||
"force-ssl-{0}.conf"
|
|
||||||
.format(wo_domain_name))
|
|
||||||
if not WOService.reload_service(self, 'nginx'):
|
if not WOService.reload_service(self, 'nginx'):
|
||||||
Log.error(self, "service nginx reload failed. "
|
Log.error(self, "service nginx reload failed. "
|
||||||
"check issues with `nginx -t` command")
|
"check issues with `nginx -t` command")
|
||||||
|
|||||||
@@ -1307,11 +1307,19 @@ def removeAcmeConf(self, domain):
|
|||||||
"-d {0} --ecc"
|
"-d {0} --ecc"
|
||||||
.format(domain))
|
.format(domain))
|
||||||
except CommandExecutionError as e:
|
except CommandExecutionError as e:
|
||||||
Log.error(self, "Cert removal failed")
|
Log.error(self, "Cert removal failed")
|
||||||
WOFileUtils.remove(self, '/etc/letsencrypt/renewal/{0}_ecc'
|
WOFileUtils.rm(self, '/etc/letsencrypt/renewal/{0}_ecc'
|
||||||
.format(domain))
|
.format(domain))
|
||||||
WOFileUtils.remove(self, '/etc/letsencrypt/live/{0}'
|
WOFileUtils.rm(self, '/etc/letsencrypt/live/{0}'
|
||||||
.format(domain))
|
.format(domain))
|
||||||
|
WOFileUtils.rm(self, '/var/www/{0}/conf/nginx/ssl.conf'.format(domain))
|
||||||
|
WOFileUtils.rm(self, '/var/www/{0}/conf/nginx/ssl.conf.disabled'
|
||||||
|
.format(domain))
|
||||||
|
WOFileUtils.rm(
|
||||||
|
self, '/etc/nginx/conf.d/force-ssl-{0}.conf'.format(domain))
|
||||||
|
WOFileUtils.rm(
|
||||||
|
self, '/etc/nginx/conf.d/force-ssl-{0}.conf.disabled'.format(domain))
|
||||||
|
|
||||||
WOGit.add(self, ["/etc/letsencrypt"],
|
WOGit.add(self, ["/etc/letsencrypt"],
|
||||||
msg="Deleted {0} "
|
msg="Deleted {0} "
|
||||||
.format(domain))
|
.format(domain))
|
||||||
|
|||||||
@@ -229,17 +229,17 @@ class WOStackUpgradeController(CementBaseController):
|
|||||||
|
|
||||||
if self.app.pargs.phpmyadmin:
|
if self.app.pargs.phpmyadmin:
|
||||||
Log.info(self, "Upgrading phpMyAdmin, please wait...")
|
Log.info(self, "Upgrading phpMyAdmin, please wait...")
|
||||||
WOExtract.extract(
|
WOExtract.extract(self, '/var/lib/wo/tmp/pma.tar.gz',
|
||||||
self, '/var/lib/wo/tmp/pma.tar.gz', '/var/lib/wo/tmp/')
|
'/var/lib/wo/tmp/')
|
||||||
shutil.copyfile('{0}22222/htdocs/db/pma'
|
shutil.copyfile(('{0}22222/htdocs/db/pma'
|
||||||
'/config.inc.php'
|
'/config.inc.php'
|
||||||
.format(WOVariables.wo_webroot),
|
.format(WOVariables.wo_webroot)),
|
||||||
'/var/lib/wo/tmp/phpMyAdmin-{0}'
|
('/var/lib/wo/tmp/phpMyAdmin-{0}'
|
||||||
'-all-languages/config.inc.php'
|
'-all-languages/config.inc.php'
|
||||||
.format(WOVariables.wo_phpmyadmin)
|
.format(WOVariables.wo_phpmyadmin))
|
||||||
)
|
)
|
||||||
WOFileUtils.remove(self, '{0}22222/htdocs/db/pma'
|
WOFileUtils.rm(self, '{0}22222/htdocs/db/pma/'
|
||||||
.format(WOVariables.wo_webroot))
|
.format(WOVariables.wo_webroot))
|
||||||
shutil.move('/var/lib/wo/tmp/phpMyAdmin-{0}'
|
shutil.move('/var/lib/wo/tmp/phpMyAdmin-{0}'
|
||||||
'-all-languages/'
|
'-all-languages/'
|
||||||
.format(WOVariables.wo_phpmyadmin),
|
.format(WOVariables.wo_phpmyadmin),
|
||||||
|
|||||||
Reference in New Issue
Block a user