Add wo site update alias

This commit is contained in:
VirtuBox
2023-08-12 22:41:19 +02:00
parent 26fbedb26f
commit 32db43a34d

View File

@@ -61,6 +61,9 @@ class WOSiteUpdateController(CementBaseController):
action='store_true')), action='store_true')),
(['--wpredis'], (['--wpredis'],
dict(help="update to redis cache", action='store_true')), dict(help="update to redis cache", action='store_true')),
(['--alias'],
dict(help="domain name to redirect to",
action='store', nargs='?')),
(['-le', '--letsencrypt'], (['-le', '--letsencrypt'],
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',
@@ -147,10 +150,16 @@ class WOSiteUpdateController(CementBaseController):
proxyinfo = proxyinfo.split(':') proxyinfo = proxyinfo.split(':')
host = proxyinfo[0].strip() host = proxyinfo[0].strip()
port = '80' if len(proxyinfo) < 2 else proxyinfo[1].strip() port = '80' if len(proxyinfo) < 2 else proxyinfo[1].strip()
elif stype is None and not (pargs.proxy or pargs.letsencrypt): elif stype is None and pargs.alias:
stype, cache = 'alias', ''
alias_name = pargs.alias.strip()
if not alias_name:
Log.error(self, "Please provide alias name")
elif stype is None and not (pargs.proxy or
pargs.letsencrypt or pargs.alias):
stype, cache = 'html', 'basic' stype, cache = 'html', 'basic'
elif stype and pargs.proxy: elif stype and (pargs.proxy or pargs.alias):
Log.error(self, "--proxy can not be used with other site types") Log.error(self, "--proxy/alias can not be used with other site types")
if not pargs.site_name: if not pargs.site_name:
try: try:
@@ -274,6 +283,15 @@ class WOSiteUpdateController(CementBaseController):
data['currsitetype'] = oldsitetype data['currsitetype'] = oldsitetype
data['currcachetype'] = oldcachetype data['currcachetype'] = oldcachetype
if stype == 'alias':
data['site_name'] = wo_domain
data['www_domain'] = wo_www_domain
data['webroot'] = wo_site_webroot
data['currsitetype'] = oldsitetype
data['currcachetype'] = oldcachetype
data['alias'] = True
data['alias_name'] = alias_name
if stype == 'php': if stype == 'php':
data = dict( data = dict(
site_name=wo_domain, www_domain=wo_www_domain, site_name=wo_domain, www_domain=wo_www_domain,