stubbed out subsite
This commit is contained in:
@@ -159,13 +159,13 @@ _wo_complete()
|
|||||||
|
|
||||||
"create")
|
"create")
|
||||||
COMPREPLY=( $(compgen \
|
COMPREPLY=( $(compgen \
|
||||||
-W "--user --pass --email --html --php --php72 --php73 --php74 --php80 --php81 --php82 --php83 --mysql --wp --wpsubdir --wpsubdomain --wpfc --wpsc --proxy= --alias --wpredis --wprocket --wpce -le --letsencrypt --letsencrypt=wildcard -le=wildcard --dns --dns=dns_cf --dns=dns_dgon" \
|
-W "--user --pass --email --html --php --php72 --php73 --php74 --php80 --php81 --php82 --php83 --mysql --wp --wpsubdir --wpsubdomain --wpfc --wpsc --proxy= --alias --subsite --wpredis --wprocket --wpce -le --letsencrypt --letsencrypt=wildcard -le=wildcard --dns --dns=dns_cf --dns=dns_dgon" \
|
||||||
-- $cur) )
|
-- $cur) )
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"update")
|
"update")
|
||||||
COMPREPLY=( $(compgen \
|
COMPREPLY=( $(compgen \
|
||||||
-W "--password --php --php72 --php73 --php74 --php80 --php81 --php82 --php83 --mysql --wp --wpsubdir --wpsubdomain --wpfc --wpsc --wpredis --wprocket --wpce --alias -le -le=off --letsencrypt --letsencrypt=off --letsencrypt=clean -le=wildcard -le=clean --dns --dns=dns_cf --dns=dns_dgon --ngxblocker --ngxblocker=off" \
|
-W "--password --php --php72 --php73 --php74 --php80 --php81 --php82 --php83 --mysql --wp --wpsubdir --wpsubdomain --wpfc --wpsc --wpredis --wprocket --wpce --alias --subsite -le -le=off --letsencrypt --letsencrypt=off --letsencrypt=clean -le=wildcard -le=clean --dns --dns=dns_cf --dns=dns_dgon --ngxblocker --ngxblocker=off" \
|
||||||
-- $cur) )
|
-- $cur) )
|
||||||
;;
|
;;
|
||||||
"delete")
|
"delete")
|
||||||
|
|||||||
@@ -64,6 +64,9 @@ class WOSiteCreateController(CementBaseController):
|
|||||||
(['--alias'],
|
(['--alias'],
|
||||||
dict(help="domain name to redirect to",
|
dict(help="domain name to redirect to",
|
||||||
action='store', nargs='?')),
|
action='store', nargs='?')),
|
||||||
|
(['--subsite'],
|
||||||
|
dict(help="parent multi-site name",
|
||||||
|
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',
|
||||||
@@ -131,10 +134,17 @@ class WOSiteCreateController(CementBaseController):
|
|||||||
alias_name = pargs.alias.strip()
|
alias_name = pargs.alias.strip()
|
||||||
if not alias_name:
|
if not alias_name:
|
||||||
Log.error(self, "Please provide alias name")
|
Log.error(self, "Please provide alias name")
|
||||||
|
elif stype is None and pargs.subsite:
|
||||||
|
stype, cache = 'subsite', ''
|
||||||
|
subsite_name = pargs.subsite.strip()
|
||||||
|
if not subsite_name:
|
||||||
|
Log.error(self, "Please provide multisite parent name")
|
||||||
elif stype and pargs.proxy:
|
elif stype and pargs.proxy:
|
||||||
Log.error(self, "proxy should not be used with other site types")
|
Log.error(self, "proxy should not be used with other site types")
|
||||||
elif stype and pargs.alias:
|
elif stype and pargs.alias:
|
||||||
Log.error(self, "alias should not be used with other site types")
|
Log.error(self, "alias should not be used with other site types")
|
||||||
|
elif stype and pargs.subsite:
|
||||||
|
Log.error(self, "subsite should not be used with other site types")
|
||||||
|
|
||||||
if not pargs.site_name:
|
if not pargs.site_name:
|
||||||
try:
|
try:
|
||||||
@@ -185,6 +195,16 @@ class WOSiteCreateController(CementBaseController):
|
|||||||
data['alias_name'] = alias_name
|
data['alias_name'] = alias_name
|
||||||
data['basic'] = True
|
data['basic'] = True
|
||||||
|
|
||||||
|
if stype == 'subsite':
|
||||||
|
data = dict(
|
||||||
|
site_name=wo_domain, www_domain=wo_www_domain,
|
||||||
|
static=True, basic=False, wp=False,
|
||||||
|
wpfc=False, wpsc=False, wprocket=False, wpce=False,
|
||||||
|
multisite=False, wpsubdir=False, webroot=wo_site_webroot)
|
||||||
|
data['subsite'] = True
|
||||||
|
data['subsite_name'] = subsite_name
|
||||||
|
data['basic'] = True
|
||||||
|
|
||||||
if (pargs.php72 or pargs.php73 or pargs.php74 or
|
if (pargs.php72 or pargs.php73 or pargs.php74 or
|
||||||
pargs.php80 or pargs.php81 or pargs.php82 or pargs.php83):
|
pargs.php80 or pargs.php81 or pargs.php82 or pargs.php83):
|
||||||
data = dict(
|
data = dict(
|
||||||
@@ -332,6 +352,26 @@ class WOSiteCreateController(CementBaseController):
|
|||||||
Log.info(self, "Successfully created site"
|
Log.info(self, "Successfully created site"
|
||||||
" http://{0}".format(wo_domain))
|
" http://{0}".format(wo_domain))
|
||||||
|
|
||||||
|
elif 'subsite' in data.keys() and data['subsite']:
|
||||||
|
addNewSite(self, wo_domain, stype, cache, wo_site_webroot)
|
||||||
|
# Service Nginx Reload
|
||||||
|
if not WOService.reload_service(self, 'nginx'):
|
||||||
|
Log.info(self, Log.FAIL +
|
||||||
|
"There was a serious error encountered...")
|
||||||
|
Log.info(self, Log.FAIL + "Cleaning up afterwards...")
|
||||||
|
doCleanupAction(self, domain=wo_domain)
|
||||||
|
deleteSiteInfo(self, wo_domain)
|
||||||
|
Log.error(self, "service nginx reload failed. "
|
||||||
|
"check issues with `nginx -t` command")
|
||||||
|
Log.error(self, "Check the log for details: "
|
||||||
|
"`tail /var/log/wo/wordops.log` "
|
||||||
|
"and please try again")
|
||||||
|
if wo_auth and len(wo_auth):
|
||||||
|
for msg in wo_auth:
|
||||||
|
Log.info(self, Log.ENDC + msg, log=False)
|
||||||
|
Log.info(self, "Successfully created site"
|
||||||
|
" http://{0}".format(wo_domain))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
addNewSite(self, wo_domain, stype, cache, wo_site_webroot,
|
addNewSite(self, wo_domain, stype, cache, wo_site_webroot,
|
||||||
php_version=php_version)
|
php_version=php_version)
|
||||||
|
|||||||
@@ -836,7 +836,7 @@ def site_package_check(self, stype):
|
|||||||
stack.app = self.app
|
stack.app = self.app
|
||||||
pargs = self.app.pargs
|
pargs = self.app.pargs
|
||||||
if stype in ['html', 'proxy', 'php', 'php72', 'mysql', 'wp', 'wpsubdir',
|
if stype in ['html', 'proxy', 'php', 'php72', 'mysql', 'wp', 'wpsubdir',
|
||||||
'wpsubdomain', 'php73', 'php74', 'php80', 'php81', 'php82', 'php83', 'alias']:
|
'wpsubdomain', 'php73', 'php74', 'php80', 'php81', 'php82', 'php83', 'alias', 'subsite']:
|
||||||
Log.debug(self, "Setting apt_packages variable for Nginx")
|
Log.debug(self, "Setting apt_packages variable for Nginx")
|
||||||
|
|
||||||
# Check if server has nginx-custom package
|
# Check if server has nginx-custom package
|
||||||
|
|||||||
Reference in New Issue
Block a user