From ec2505cc1ac3e9bfff0379cc35b13f154f85584c Mon Sep 17 00:00:00 2001 From: Prabuddha Chakraborty Date: Fri, 19 Feb 2016 13:08:15 +0530 Subject: [PATCH] added php version in siteinfo --- ee/cli/plugins/site.py | 3 +- ee/cli/plugins/site_functions.py | 55 ++++++++++++++++++++++++-------- 2 files changed, 44 insertions(+), 14 deletions(-) diff --git a/ee/cli/plugins/site.py b/ee/cli/plugins/site.py index f0d487f8..73949ad7 100644 --- a/ee/cli/plugins/site.py +++ b/ee/cli/plugins/site.py @@ -156,6 +156,7 @@ class EESiteController(CementBaseController): error_log = "/var/log/nginx/{0}.error.log".format(ee_domain) ee_site_webroot = '' + php_version = siteinfo.php_version pagespeed = ("enabled" if siteinfo.is_pagespeed else "disabled") ssl = ("enabled" if siteinfo.is_ssl else "disabled") if (ssl == "enabled"): @@ -166,7 +167,7 @@ class EESiteController(CementBaseController): sslexpiry = '' data = dict(domain=ee_domain, webroot=ee_site_webroot, accesslog=access_log, errorlog=error_log, - dbname=ee_db_name, dbuser=ee_db_user, + dbname=ee_db_name, dbuser=ee_db_user,php_version=php_version, dbpass=ee_db_pass, hhvm=hhvm, pagespeed=pagespeed, ssl=ssl, sslprovider=sslprovider, sslexpiry= sslexpiry, type=sitetype + " " + cachetype + " ({0})" diff --git a/ee/cli/plugins/site_functions.py b/ee/cli/plugins/site_functions.py index add00d0f..8d012839 100644 --- a/ee/cli/plugins/site_functions.py +++ b/ee/cli/plugins/site_functions.py @@ -674,7 +674,7 @@ def site_package_check(self, stype): stack = EEStackController() stack.app = self.app if stype in ['html', 'proxy', 'php', 'mysql', 'wp', 'wpsubdir', - 'wpsubdomain']: + 'wpsubdomain', 'php7']: Log.debug(self, "Setting apt_packages variable for Nginx") # Check if server has nginx-custom package @@ -1083,12 +1083,24 @@ def detSitePar(opts): cachetype = 'basic' else: cachetype = cachelist[0] + elif False not in [x in ('php7','mysql','html') for x in typelist]: + sitetype = 'mysql' + if not cachelist: + cachetype = 'basic' + else: + cachetype = cachelist[0] elif False not in [x in ('php','mysql') for x in typelist]: sitetype = 'mysql' if not cachelist: cachetype = 'basic' else: cachetype = cachelist[0] + elif False not in [x in ('php7','mysql') for x in typelist]: + sitetype = 'mysql' + if not cachelist: + cachetype = 'basic' + else: + cachetype = cachelist[0] elif False not in [x in ('html','mysql') for x in typelist]: sitetype = 'mysql' if not cachelist: @@ -1101,6 +1113,12 @@ def detSitePar(opts): cachetype = 'basic' else: cachetype = cachelist[0] + elif False not in [x in ('php7','html') for x in typelist]: + sitetype = 'php' + if not cachelist: + cachetype = 'basic' + else: + cachetype = cachelist[0] elif False not in [x in ('wp','wpsubdir') for x in typelist]: sitetype = 'wpsubdir' if not cachelist: @@ -1119,22 +1137,33 @@ def detSitePar(opts): cachetype = 'basic' else: cachetype = cachelist[0] + elif False not in [x in ('wpsubdir','php7') for x in typelist]: + sitetype = 'wpsubdir' + if not cachelist: + cachetype = 'basic' + else: + cachetype = cachelist[0] + elif False not in [x in ('wpsubdomain','php7') for x in typelist]: + sitetype = 'wpsubdomain' + if not cachelist: + cachetype = 'basic' + else: + cachetype = cachelist[0] else: raise RuntimeError("could not determine site and cache type") + if not typelist and not cachelist: + sitetype = None + cachetype = None + elif (not typelist) and cachelist: + sitetype = 'wp' + cachetype = cachelist[0] + elif typelist and (not cachelist): + sitetype = typelist[0] + cachetype = 'basic' else: - if not typelist and not cachelist: - sitetype = None - cachetype = None - elif (not typelist) and cachelist: - sitetype = 'wp' - cachetype = cachelist[0] - elif typelist and (not cachelist): - sitetype = typelist[0] - cachetype = 'basic' - else: - sitetype = typelist[0] - cachetype = cachelist[0] + sitetype = typelist[0] + cachetype = cachelist[0] return (sitetype, cachetype)