From b5eba6cffecbcc5e4a1897102d91a09c2eef149a Mon Sep 17 00:00:00 2001 From: harshadyeola Date: Mon, 20 Apr 2015 16:22:12 +0530 Subject: [PATCH 1/9] update all done --- ee/cli/plugins/site.py | 71 +++++++++++++++++++++----------- ee/cli/plugins/site_functions.py | 14 +++++++ 2 files changed, 62 insertions(+), 23 deletions(-) diff --git a/ee/cli/plugins/site.py b/ee/cli/plugins/site.py index fbbf42ca..16923219 100644 --- a/ee/cli/plugins/site.py +++ b/ee/cli/plugins/site.py @@ -604,34 +604,52 @@ class EESiteUpdateController(CementBaseController): (['--pagespeed'], dict(help='Use PageSpeed for site', action='store' or 'store_const', - choices=('on', 'off'), const='on', nargs='?')) + choices=('on', 'off'), const='on', nargs='?')), + (['--all'], + dict(help="update all sites", action='store_true')), ] @expose(help="Update site type or cache") def default(self): + pargs = self.app.pargs + + if pargs.all: + sites = getAllsites(self) + if not sites: + Log.info(self, "no sites :(") + pass + else: + Log.info(self, "updating sites :)") + for site in sites: + pargs.site_name = site.sitename + Log.info(self, "Updating site {0}, please wait ..." + .format(pargs.site_name)) + self.doupdatesite(pargs) + else: + self.doupdatesite(pargs) + def doupdatesite(self, pargs): hhvm = None pagespeed = None data = dict() try: - stype, cache = detSitePar(vars(self.app.pargs)) + stype, cache = detSitePar(vars(pargs)) except RuntimeError as e: Log.debug(self, str(e)) Log.error(self, "Please provide valid options combination for" " site update") - if not self.app.pargs.site_name: + if not pargs.site_name: try: - while not self.app.pargs.site_name: - self.app.pargs.site_name = (input('Enter site name : ') - .strip()) + while not pargs.site_name: + pargs.site_name = (input('Enter site name : ').strip()) except IOError as e: Log.error(self, 'Unable to input site name, Please try again!') - self.app.pargs.site_name = self.app.pargs.site_name.strip() + pargs.site_name = pargs.site_name.strip() (ee_domain, - ee_www_domain, ) = ValidateDomain(self.app.pargs.site_name) + ee_www_domain, ) = ValidateDomain(pargs.site_name) ee_site_webroot = EEVariables.ee_webroot + ee_domain check_site = getSiteInfo(self, ee_domain) @@ -644,10 +662,10 @@ class EESiteUpdateController(CementBaseController): old_hhvm = check_site.is_hhvm old_pagespeed = check_site.is_pagespeed - if (self.app.pargs.password and not (self.app.pargs.html or - self.app.pargs.php or self.app.pargs.mysql or self.app.pargs.wp or - self.app.pargs.w3tc or self.app.pargs.wpfc or self.app.pargs.wpsc - or self.app.pargs.wpsubdir or self.app.pargs.wpsubdomain)): + if (pargs.password and not (pargs.html or + pargs.php or pargs.mysql or pargs.wp or + pargs.w3tc or pargs.wpfc or pargs.wpsc + or pargs.wpsubdir or pargs.wpsubdomain)): try: updatewpuserpassword(self, ee_domain, ee_site_webroot) except SiteError as e: @@ -691,7 +709,7 @@ class EESiteUpdateController(CementBaseController): if stype == 'wpsubdir': data['wpsubdir'] = True - if self.app.pargs.pagespeed or self.app.pargs.hhvm: + if pargs.pagespeed or pargs.hhvm: if not data: data = dict(site_name=ee_domain, www_domain=ee_www_domain, currsitetype=oldsitetype, @@ -748,21 +766,21 @@ class EESiteUpdateController(CementBaseController): data['wpfc'] = False data['wpsc'] = True - if self.app.pargs.hhvm != 'off': + if pargs.hhvm != 'off': data['hhvm'] = True hhvm = True - elif self.app.pargs.hhvm == 'off': + elif pargs.hhvm == 'off': data['hhvm'] = False hhvm = False - if self.app.pargs.pagespeed != 'off': + if pargs.pagespeed != 'off': data['pagespeed'] = True pagespeed = True - elif self.app.pargs.pagespeed == 'off': + elif pargs.pagespeed == 'off': data['pagespeed'] = False pagespeed = False - if self.app.pargs.pagespeed: + if pargs.pagespeed: if pagespeed is old_pagespeed: if pagespeed is False: Log.info(self, "Pagespeed is allready disabled for given " @@ -771,7 +789,7 @@ class EESiteUpdateController(CementBaseController): Log.info(self, "Pagespeed is allready enabled for given " "site") - if self.app.pargs.hhvm: + if pargs.hhvm: if hhvm is old_hhvm: if hhvm is False: Log.info(self, "HHVM is allready disabled for given " @@ -780,12 +798,12 @@ class EESiteUpdateController(CementBaseController): Log.info(self, "HHVM is allready enabled for given " "site") - if self.app.pargs.pagespeed or self.app.pargs.hhvm: + if pargs.pagespeed or pargs.hhvm: if ((hhvm is old_hhvm) and (pagespeed is old_pagespeed) and (stype == oldsitetype and cache == oldcachetype)): self.app.close(0) - if data and (not self.app.pargs.hhvm): + if data and (not pargs.hhvm): if old_hhvm is True: data['hhvm'] = True hhvm = True @@ -793,7 +811,7 @@ class EESiteUpdateController(CementBaseController): data['hhvm'] = False hhvm = False - if data and (not self.app.pargs.pagespeed): + if data and (not pargs.pagespeed): if old_pagespeed is True: data['pagespeed'] = True pagespeed = True @@ -810,6 +828,13 @@ class EESiteUpdateController(CementBaseController): data['ee_db_user'] = check_site.db_user data['ee_db_pass'] = check_site.db_password data['ee_db_host'] = check_site.db_host + + try: + pre_run_checks(self) + except SiteError as e: + Log.debug(self, str(e)) + Log.error(self, "NGINX configuration check failed.") + try: sitebackup(self, data) except Exception as e: @@ -826,7 +851,7 @@ class EESiteUpdateController(CementBaseController): "`tail /var/log/ee/ee.log` & Try Again!!!") # Update pagespeed config - if self.app.pargs.pagespeed: + if pargs.pagespeed: operateOnPagespeed(self, data) if stype == oldsitetype and cache == oldcachetype: diff --git a/ee/cli/plugins/site_functions.py b/ee/cli/plugins/site_functions.py index 6dac2414..7fb31402 100644 --- a/ee/cli/plugins/site_functions.py +++ b/ee/cli/plugins/site_functions.py @@ -28,6 +28,20 @@ class SiteError(Exception): return repr(self.message) +def pre_run_checks(self): + + # Check nginx configuration + Log.info(self, "Running pre-update checks, please wait ...") + try: + Log.debug(self, "checking NGINX configuration ...") + FNULL = open('/dev/null', 'w') + ret = subprocess.check_call(["nginx", "-t"], stdout=FNULL, + stderr=subprocess.STDOUT) + except CalledProcessError as e: + Log.debug(self, "{0}".format(str(e))) + raise SiteError("nginx configuration check failed.") + + def check_domain_exists(self, domain): if getSiteInfo(self, domain): return True From 5b652a5282d1af9f91791089101c01dd36399c0b Mon Sep 17 00:00:00 2001 From: harshadyeola Date: Mon, 20 Apr 2015 19:01:30 +0530 Subject: [PATCH 2/9] This commit Fixes #491 --- ee/cli/plugins/site.py | 113 +++++++++++++++++++++-------------------- 1 file changed, 59 insertions(+), 54 deletions(-) diff --git a/ee/cli/plugins/site.py b/ee/cli/plugins/site.py index 16923219..e0c5aa56 100644 --- a/ee/cli/plugins/site.py +++ b/ee/cli/plugins/site.py @@ -613,18 +613,21 @@ class EESiteUpdateController(CementBaseController): def default(self): pargs = self.app.pargs + if pargs.all and pargs.site_name: + Log.error(self, "`--all` option cannot be used with site name") + if pargs.all: sites = getAllsites(self) if not sites: - Log.info(self, "no sites :(") pass else: - Log.info(self, "updating sites :)") for site in sites: pargs.site_name = site.sitename - Log.info(self, "Updating site {0}, please wait ..." + Log.info(self, Log.ENDC + Log.BOLD + "Updating site {0}," + " please wait ..." .format(pargs.site_name)) self.doupdatesite(pargs) + print("\n") else: self.doupdatesite(pargs) @@ -670,8 +673,8 @@ class EESiteUpdateController(CementBaseController): updatewpuserpassword(self, ee_domain, ee_site_webroot) except SiteError as e: Log.debug(self, str(e)) - Log.error(self, "Password Unchanged.") - self.app.close(0) + Log.info(self, "Password Unchanged.") + return 0 if ((stype == 'php' and oldsitetype != 'html') or (stype == 'mysql' and oldsitetype not in ['html', 'php']) or @@ -680,8 +683,9 @@ class EESiteUpdateController(CementBaseController): (stype == 'wpsubdir' and oldsitetype in ['wpsubdomain']) or (stype == 'wpsubdomain' and oldsitetype in ['wpsubdir']) or (stype == oldsitetype and cache == oldcachetype)): - Log.error(self, "can not update {0} {1} to {2} {3}". - format(oldsitetype, oldcachetype, stype, cache)) + Log.info(self, Log.FAIL + "can not update {0} {1} to {2} {3}". + format(oldsitetype, oldcachetype, stype, cache)) + return 1 if stype == 'php': data = dict(site_name=ee_domain, www_domain=ee_www_domain, @@ -783,7 +787,7 @@ class EESiteUpdateController(CementBaseController): if pargs.pagespeed: if pagespeed is old_pagespeed: if pagespeed is False: - Log.info(self, "Pagespeed is allready disabled for given " + Log.info(self, "Pagespeed is already disabled for given " "site") elif pagespeed is True: Log.info(self, "Pagespeed is allready enabled for given " @@ -801,7 +805,7 @@ class EESiteUpdateController(CementBaseController): if pargs.pagespeed or pargs.hhvm: if ((hhvm is old_hhvm) and (pagespeed is old_pagespeed) and (stype == oldsitetype and cache == oldcachetype)): - self.app.close(0) + return 1 if data and (not pargs.hhvm): if old_hhvm is True: @@ -820,7 +824,7 @@ class EESiteUpdateController(CementBaseController): pagespeed = False if not data: - Log.error(self, " Cannot update {0}, Invalid Options" + Log.error(self, "Cannot update {0}, Invalid Options" .format(ee_domain)) ee_auth = site_package_check(self, stype) @@ -839,16 +843,19 @@ class EESiteUpdateController(CementBaseController): sitebackup(self, data) except Exception as e: Log.debug(self, str(e)) - Log.error(self, "Check logs for reason " - "`tail /var/log/ee/ee.log` & Try Again!!!") + Log.info(self, Log.FAIL + "Check logs for reason " + "`tail /var/log/ee/ee.log` & Try Again!!!") + return 1 # setup NGINX configuration, and webroot try: setupdomain(self, data) except SiteError as e: Log.debug(self, str(e)) - Log.error(self, "Update site failed. Check logs for reason " - "`tail /var/log/ee/ee.log` & Try Again!!!") + Log.info(self, Log.FAIL + "Update site failed." + "Check logs for reason" + "`tail /var/log/ee/ee.log` & Try Again!!!") + return 1 # Update pagespeed config if pargs.pagespeed: @@ -864,15 +871,17 @@ class EESiteUpdateController(CementBaseController): Log.info(self, "Successfully updated site" " http://{0}".format(ee_domain)) - self.app.close(0) + return 0 if 'ee_db_name' in data.keys() and not data['wp']: try: data = setupdatabase(self, data) except SiteError as e: Log.debug(self, str(e)) - Log.error(self, "Update site failed. Check logs for reason " - "`tail /var/log/ee/ee.log` & Try Again!!!") + Log.info(self, Log.FAIL + "Update site failed." + "Check logs for reason" + "`tail /var/log/ee/ee.log` & Try Again!!!") + return 1 try: eedbconfig = open("{0}/ee-config.php".format(ee_site_webroot), encoding='utf-8', mode='w') @@ -888,28 +897,10 @@ class EESiteUpdateController(CementBaseController): except IOError as e: Log.debug(self, str(e)) Log.debug(self, "creating ee-config.php failed.") - Log.error(self, "Update site failed. Check logs for reason " - "`tail /var/log/ee/ee.log` & Try Again!!!") - - # if oldsitetype == 'mysql': - # # config_file = (ee_site_webroot + '/backup/{0}/ee-config.php' - # # .format(EEVariables.ee_date)) - # # data['ee_db_name'] = (EEFileUtils.grep(self, config_file, - # # 'DB_NAME') - # # .split(',')[1] - # # .split(')')[0].strip()) - # # data['ee_db_user'] = (EEFileUtils.grep(self, config_file, - # # 'DB_USER') - # # .split(',')[1] - # # .split(')')[0].strip()) - # # data['ee_db_pass'] = (EEFileUtils.grep(self, config_file, - # # 'DB_PASSWORD') - # # .split(',')[1] - # # .split(')')[0].strip()) - # # data['ee_db_host'] = (EEFileUtils.grep(self, config_file, - # # 'DB_HOST') - # # .split(',')[1] - # # .split(')')[0].strip()) + Log.info(self, Log.FAIL + "Update site failed. " + "Check logs for reason " + "`tail /var/log/ee/ee.log` & Try Again!!!") + return 1 # Setup WordPress if old sites are html/php/mysql sites if data['wp'] and oldsitetype in ['html', 'php', 'mysql']: @@ -917,8 +908,10 @@ class EESiteUpdateController(CementBaseController): ee_wp_creds = setupwordpress(self, data) except SiteError as e: Log.debug(self, str(e)) - Log.error(self, "Update site failed. Check logs for reason " - "`tail /var/log/ee/ee.log` & Try Again!!!") + Log.info(self, Log.FAIL + "Update site failed." + "Check logs for reason " + "`tail /var/log/ee/ee.log` & Try Again!!!") + return 1 # Uninstall unnecessary plugins if oldsitetype in ['wp', 'wpsubdir', 'wpsubdomain']: @@ -929,8 +922,10 @@ class EESiteUpdateController(CementBaseController): setupwordpressnetwork(self, data) except SiteError as e: Log.debug(self, str(e)) - Log.error(self, "Update site failed. Check logs for reason" - " `tail /var/log/ee/ee.log` & Try Again!!!") + Log.info(self, Log.FAIL + "Update site failed. " + "Check logs for reason" + " `tail /var/log/ee/ee.log` & Try Again!!!") + return 1 if (oldcachetype == 'w3tc' or oldcachetype == 'wpfc' and not (data['w3tc'] or data['wpfc'])): @@ -938,16 +933,20 @@ class EESiteUpdateController(CementBaseController): uninstallwp_plugin(self, 'w3-total-cache', data) except SiteError as e: Log.debug(self, str(e)) - Log.error(self, "Update site failed. Check logs for reason" - " `tail /var/log/ee/ee.log` & Try Again!!!") + Log.info(self, Log.FAIL + "Update site failed. " + "Check logs for reason" + " `tail /var/log/ee/ee.log` & Try Again!!!") + return 1 if oldcachetype == 'wpsc' and not data['wpsc']: try: uninstallwp_plugin(self, 'wp-super-cache', data) except SiteError as e: Log.debug(self, str(e)) - Log.error(self, "Update site failed. Check logs for reason" - " `tail /var/log/ee/ee.log` & Try Again!!!") + Log.info(self, Log.FAIL + "Update site failed." + "Check logs for reason" + " `tail /var/log/ee/ee.log` & Try Again!!!") + return 1 if (oldcachetype != 'w3tc' or oldcachetype != 'wpfc') and (data['w3tc'] or data['wpfc']): @@ -955,17 +954,20 @@ class EESiteUpdateController(CementBaseController): installwp_plugin(self, 'w3-total-cache', data) except SiteError as e: Log.debug(self, str(e)) - Log.error(self, "Update site failed. Check logs for reason" - " `tail /var/log/ee/ee.log` & Try Again!!!") + Log.info(self, Log.FAIL + "Update site failed." + "Check logs for reason" + " `tail /var/log/ee/ee.log` & Try Again!!!") + return 1 if oldcachetype != 'wpsc' and data['wpsc']: try: installwp_plugin(self, 'wp-super-cache', data) except SiteError as e: Log.debug(self, str(e)) - Log.error(self, "Update site failed. Check logs for reason " - "`tail /var/log/ee/ee.log` & Try Again!!!") - + Log.info(self, Log.FAIL + "Update site failed." + "Check logs for reason " + "`tail /var/log/ee/ee.log` & Try Again!!!") + return 1 # Service Nginx Reload EEService.reload_service(self, 'nginx') @@ -977,8 +979,10 @@ class EESiteUpdateController(CementBaseController): setwebrootpermissions(self, data['webroot']) except SiteError as e: Log.debug(self, str(e)) - Log.error(self, "Update site failed. Check logs for reason " - "`tail /var/log/ee/ee.log` & Try Again!!!") + Log.info(self, Log.FAIL + "Update site failed." + "Check logs for reason " + "`tail /var/log/ee/ee.log` & Try Again!!!") + return 1 if ee_auth and len(ee_auth): for msg in ee_auth: @@ -1002,6 +1006,7 @@ class EESiteUpdateController(CementBaseController): hhvm=hhvm, pagespeed=pagespeed) Log.info(self, "Successfully updated site" " http://{0}".format(ee_domain)) + return 0 class EESiteDeleteController(CementBaseController): From 17fc9d6219ec057faa79da9d4b4d03bfe9efb3c1 Mon Sep 17 00:00:00 2001 From: harshadyeola Date: Tue, 21 Apr 2015 13:41:56 +0530 Subject: [PATCH 3/9] updated autocomplete --- config/bash_completion.d/ee_auto.rc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/config/bash_completion.d/ee_auto.rc b/config/bash_completion.d/ee_auto.rc index 26d30ad3..a80c50f0 100644 --- a/config/bash_completion.d/ee_auto.rc +++ b/config/bash_completion.d/ee_auto.rc @@ -93,7 +93,7 @@ _ee_complete() -- $cur) ) ;; - "edit" | "enable" | "info" | "log" | "show" | "cd" | "update" | "delete") + "edit" | "enable" | "info" | "log" | "show" | "cd" | "delete") if [ ${COMP_WORDS[1]} == "log" ]; then COMPREPLY=( $(compgen \ -W "$(find /etc/nginx/sites-available/ -type f -printf "%P " 2> /dev/null) --nginx --php --fpm --mysql --access" \ @@ -104,7 +104,11 @@ _ee_complete() -- $cur) ) fi ;; - + "update") + COMPREPLY=( $(compgen \ + -W "$(find /etc/nginx/sites-available/ -type f -printf "%P " 2> /dev/null) --all" \ + -- $cur) ) + ;; "gzip") COMPREPLY=( $(compgen \ -W "$(find /etc/nginx/sites-available/ -type f -printf "%P " 2> /dev/null) --nginx --php --fpm --mysql --access" \ From fc2b3eada3655dbdd56b17276d5d7d81bc87a487 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Tue, 21 Apr 2015 15:30:03 +0530 Subject: [PATCH 4/9] Fixed updateall setup --- ee/cli/plugins/site.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ee/cli/plugins/site.py b/ee/cli/plugins/site.py index e0c5aa56..8a920326 100644 --- a/ee/cli/plugins/site.py +++ b/ee/cli/plugins/site.py @@ -802,11 +802,6 @@ class EESiteUpdateController(CementBaseController): Log.info(self, "HHVM is allready enabled for given " "site") - if pargs.pagespeed or pargs.hhvm: - if ((hhvm is old_hhvm) and (pagespeed is old_pagespeed) and - (stype == oldsitetype and cache == oldcachetype)): - return 1 - if data and (not pargs.hhvm): if old_hhvm is True: data['hhvm'] = True @@ -823,6 +818,11 @@ class EESiteUpdateController(CementBaseController): data['pagespeed'] = False pagespeed = False + if pargs.pagespeed or pargs.hhvm: + if ((hhvm is old_hhvm) and (pagespeed is old_pagespeed) and + (stype == oldsitetype and cache == oldcachetype)): + return 1 + if not data: Log.error(self, "Cannot update {0}, Invalid Options" .format(ee_domain)) From ad4084868801613182fa7881262ddb731b2f32b3 Mon Sep 17 00:00:00 2001 From: harshadyeola Date: Tue, 21 Apr 2015 15:51:23 +0530 Subject: [PATCH 5/9] added check to pass options with --all option --- config/bash_completion.d/ee_auto.rc | 5 +++-- ee/cli/plugins/site.py | 13 +++++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/config/bash_completion.d/ee_auto.rc b/config/bash_completion.d/ee_auto.rc index a80c50f0..fa227087 100644 --- a/config/bash_completion.d/ee_auto.rc +++ b/config/bash_completion.d/ee_auto.rc @@ -262,9 +262,10 @@ _ee_complete() "--all") if [ ${COMP_WORDS[1]} == "clean" ]; then retlist="--memcache --opcache --fastcgi" - else + elif [ ${COMP_WORDS[2]} == "delete" ]; then retlist="--db --files" - + else + retlist="" fi ret="${retlist[@]/$prev}" COMPREPLY=( $(compgen \ diff --git a/ee/cli/plugins/site.py b/ee/cli/plugins/site.py index e0c5aa56..13647d7e 100644 --- a/ee/cli/plugins/site.py +++ b/ee/cli/plugins/site.py @@ -613,8 +613,17 @@ class EESiteUpdateController(CementBaseController): def default(self): pargs = self.app.pargs - if pargs.all and pargs.site_name: - Log.error(self, "`--all` option cannot be used with site name") + if pargs.all: + if pargs.site_name: + Log.error(self, "`--all` option cannot be used with site name" + " provided") + if pargs.html: + Log.error(self, "No site can be updated to html") + if not (pargs.php or + pargs.mysql or pargs.wp or pargs.wpsubdir or + pargs.wpsubdomain or pargs.w3tc or pargs.wpfc or + pargs.wpsc or pargs.hhvm or pargs.pagespeed): + Log.error(self, "Please provide options to update sites.") if pargs.all: sites = getAllsites(self) From 94ca55115621f5befd1bfe8b1bcb1a587a10540b Mon Sep 17 00:00:00 2001 From: harshadyeola Date: Tue, 21 Apr 2015 15:57:15 +0530 Subject: [PATCH 6/9] minor update --- config/bash_completion.d/ee_auto.rc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/bash_completion.d/ee_auto.rc b/config/bash_completion.d/ee_auto.rc index fa227087..bff525f3 100644 --- a/config/bash_completion.d/ee_auto.rc +++ b/config/bash_completion.d/ee_auto.rc @@ -264,6 +264,8 @@ _ee_complete() retlist="--memcache --opcache --fastcgi" elif [ ${COMP_WORDS[2]} == "delete" ]; then retlist="--db --files" + elif [ ${COMP_WORDS[2]} == "update" ]; then + retlist="--password --php --mysql --wp --wpsubdir --wpsubdomain --w3tc --wpfc --wpsc --hhvm --hhvm=off --pagespeed --pagespeed=off" else retlist="" fi From 44251ad883ca7b5034a33701af7682172c4f66ba Mon Sep 17 00:00:00 2001 From: harshadyeola Date: Tue, 21 Apr 2015 16:39:50 +0530 Subject: [PATCH 7/9] fixed bugs related to hhvm update --- config/bash_completion.d/ee_auto.rc | 1 - ee/cli/plugins/site.py | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/config/bash_completion.d/ee_auto.rc b/config/bash_completion.d/ee_auto.rc index bff525f3..fa9b0d80 100644 --- a/config/bash_completion.d/ee_auto.rc +++ b/config/bash_completion.d/ee_auto.rc @@ -239,7 +239,6 @@ _ee_complete() elif [ ${COMP_WORDS[2]} == "reset" ]; then retlist="--access --nginx --php --mysql --fpm --wp --slow-log-db" - elif [ ${COMP_WORDS[2]} == "mail" ]; then retlist="--access --nginx --php --mysql --fpm --wp --to=" diff --git a/ee/cli/plugins/site.py b/ee/cli/plugins/site.py index 7f394f1e..c1271ca6 100644 --- a/ee/cli/plugins/site.py +++ b/ee/cli/plugins/site.py @@ -685,6 +685,10 @@ class EESiteUpdateController(CementBaseController): Log.info(self, "Password Unchanged.") return 0 + if stype == "html" and self.app.pargs.hhvm: + Log.info(self, Log.FAIL + "Can not update HTML site to HHVM") + return 1 + if ((stype == 'php' and oldsitetype != 'html') or (stype == 'mysql' and oldsitetype not in ['html', 'php']) or (stype == 'wp' and oldsitetype not in ['html', 'php', 'mysql', From 03f7a37f147e6f08c3f8ebd56b2688a07ca11b74 Mon Sep 17 00:00:00 2001 From: harshadyeola Date: Tue, 21 Apr 2015 17:11:17 +0530 Subject: [PATCH 8/9] minor update in mustache template --- ee/cli/plugins/site.py | 3 ++- ee/cli/templates/virtualconf.mustache | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ee/cli/plugins/site.py b/ee/cli/plugins/site.py index c1271ca6..61f82f5e 100644 --- a/ee/cli/plugins/site.py +++ b/ee/cli/plugins/site.py @@ -695,7 +695,8 @@ class EESiteUpdateController(CementBaseController): 'wp']) or (stype == 'wpsubdir' and oldsitetype in ['wpsubdomain']) or (stype == 'wpsubdomain' and oldsitetype in ['wpsubdir']) or - (stype == oldsitetype and cache == oldcachetype)): + (stype == oldsitetype and cache == oldcachetype) and + not pargs.pagespeed): Log.info(self, Log.FAIL + "can not update {0} {1} to {2} {3}". format(oldsitetype, oldcachetype, stype, cache)) return 1 diff --git a/ee/cli/templates/virtualconf.mustache b/ee/cli/templates/virtualconf.mustache index b4b065c1..2fa0a0d1 100644 --- a/ee/cli/templates/virtualconf.mustache +++ b/ee/cli/templates/virtualconf.mustache @@ -27,8 +27,8 @@ server { } {{/static}} - {{^static}}include{{/static}} {{^hhvm}}{{#basic}}common/php.conf;{{/basic}}{{#w3tc}}common/w3tc.conf;{{/w3tc}}{{#wpfc}}common/wpfc.conf;{{/wpfc}} {{#wpsc}}common/wpsc.conf;{{/wpsc}} {{/hhvm}}{{#hhvm}}{{#basic}}common/php-hhvm.conf;{{/basic}}{{#w3tc}}common/w3tc-hhvm.conf;{{/w3tc}}{{#wpfc}}common/wpfc-hhvm.conf;{{/wpfc}} {{#wpsc}}common/wpsc-hhvm.conf;{{/wpsc}} {{/hhvm}} - {{#wpsubdir}}include common/wpsubdir.conf;{{/wpsubdir}} + {{^static}}include {{^hhvm}}{{#basic}}common/php.conf;{{/basic}}{{#w3tc}}common/w3tc.conf;{{/w3tc}}{{#wpfc}}common/wpfc.conf;{{/wpfc}} {{#wpsc}}common/wpsc.conf;{{/wpsc}} {{/hhvm}}{{#hhvm}}{{#basic}}common/php-hhvm.conf;{{/basic}}{{#w3tc}}common/w3tc-hhvm.conf;{{/w3tc}}{{#wpfc}}common/wpfc-hhvm.conf;{{/wpfc}} {{#wpsc}}common/wpsc-hhvm.conf;{{/wpsc}} {{/hhvm}} + {{#wpsubdir}}include common/wpsubdir.conf;{{/wpsubdir}}{{/static}} {{#wp}}include common/wpcommon.conf;{{/wp}} include common/locations.conf; {{^vma}}{{^rc}}include {{webroot}}/conf/nginx/*.conf;{{/rc}}{{/vma}} From ba8bb58f3473a15b1f36d0715aad0b4a736b80cd Mon Sep 17 00:00:00 2001 From: harshadyeola Date: Tue, 21 Apr 2015 17:23:35 +0530 Subject: [PATCH 9/9] minor update --- ee/cli/plugins/site.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ee/cli/plugins/site.py b/ee/cli/plugins/site.py index 61f82f5e..913ec4ad 100644 --- a/ee/cli/plugins/site.py +++ b/ee/cli/plugins/site.py @@ -685,7 +685,7 @@ class EESiteUpdateController(CementBaseController): Log.info(self, "Password Unchanged.") return 0 - if stype == "html" and self.app.pargs.hhvm: + if stype == "html" and stype == oldsitetype and self.app.pargs.hhvm: Log.info(self, Log.FAIL + "Can not update HTML site to HHVM") return 1