From b5ac5477015382ee9ff2bd00cfdb2e6ea5e109f7 Mon Sep 17 00:00:00 2001 From: Prabuddha Chakraborty Date: Thu, 15 Oct 2015 19:03:02 +0530 Subject: [PATCH 01/12] Fix #630 --- ee/cli/plugins/stack.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/ee/cli/plugins/stack.py b/ee/cli/plugins/stack.py index 2b1db1b9..10b413c1 100644 --- a/ee/cli/plugins/stack.py +++ b/ee/cli/plugins/stack.py @@ -1641,6 +1641,8 @@ class EEStackController(CementBaseController): if self.app.pargs.redis: if not EEAptGet.is_installed(self, 'redis-server'): apt_packages = apt_packages + EEVariables.ee_redis + self.app.pargs.php = True + redis_install_flag = True else: Log.info(self, "Redis already installed") @@ -1816,6 +1818,25 @@ class EEStackController(CementBaseController): else: return self.msg + if redis_install_flag: + if os.path.isfile("/etc/redis/redis.conf"): + if EEVariables.ee_ram < 512: + EEFileUtils.searchreplace(self, "/etc/redis/redis.conf", + "# maxmemory ", + "maxmemory {0}".format(int(EEVariables.ee_ram*1024*1024*0.1))) + EEFileUtils.searchreplace(self, "/etc/redis/redis.conf", + "# maxmemory-policy volatile-lru", + "maxmemory-policy volatile-lru") + EEService.restart_service(self, 'redis-server') + else: + EEFileUtils.searchreplace(self, "/etc/redis/redis.conf", + "# maxmemory ", + "maxmemory {0}".format(int(EEVariables.ee_ram*1024*1024*0.2))) + EEFileUtils.searchreplace(self, "/etc/redis/redis.conf", + "# maxmemory-policy volatile-lru", + "maxmemory-policy volatile-lru") + EEService.restart_service(self, 'redis-server') + @expose(help="Remove packages") def remove(self): """Start removal of packages""" From 1cf6463c427267c74d08c784994b11c2d319e312 Mon Sep 17 00:00:00 2001 From: Prabuddha Chakraborty Date: Thu, 15 Oct 2015 19:10:56 +0530 Subject: [PATCH 02/12] commented code --- ee/cli/plugins/stack.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ee/cli/plugins/stack.py b/ee/cli/plugins/stack.py index 10b413c1..158f3e3a 100644 --- a/ee/cli/plugins/stack.py +++ b/ee/cli/plugins/stack.py @@ -1818,6 +1818,9 @@ class EEStackController(CementBaseController): else: return self.msg + # set redis.conf parameter + # set maxmemory 10% for ram below 512MB and 20% for others + # set maxmemory-policy volatile-lru if redis_install_flag: if os.path.isfile("/etc/redis/redis.conf"): if EEVariables.ee_ram < 512: From 68494e9fe48c5f5d42bcc81983ec36d1938925b3 Mon Sep 17 00:00:00 2001 From: Prabuddha Chakraborty Date: Thu, 15 Oct 2015 19:21:04 +0530 Subject: [PATCH 03/12] added debug log entries --- ee/cli/plugins/stack.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ee/cli/plugins/stack.py b/ee/cli/plugins/stack.py index 158f3e3a..c622033a 100644 --- a/ee/cli/plugins/stack.py +++ b/ee/cli/plugins/stack.py @@ -1824,17 +1824,24 @@ class EEStackController(CementBaseController): if redis_install_flag: if os.path.isfile("/etc/redis/redis.conf"): if EEVariables.ee_ram < 512: + Log.debug(self, "Setting maxmemory variable to {0} in redis.conf" + .format(int(EEVariables.ee_ram*1024*1024*0.1))) EEFileUtils.searchreplace(self, "/etc/redis/redis.conf", "# maxmemory ", "maxmemory {0}".format(int(EEVariables.ee_ram*1024*1024*0.1))) + + Log.debug(self, "Setting maxmemory-policy variable to volatile-lru in redis.conf") EEFileUtils.searchreplace(self, "/etc/redis/redis.conf", "# maxmemory-policy volatile-lru", "maxmemory-policy volatile-lru") EEService.restart_service(self, 'redis-server') else: + Log.debug(self, "Setting maxmemory variable to {0} in redis.conf" + .format(int(EEVariables.ee_ram*1024*1024*0.2))) EEFileUtils.searchreplace(self, "/etc/redis/redis.conf", "# maxmemory ", "maxmemory {0}".format(int(EEVariables.ee_ram*1024*1024*0.2))) + Log.debug(self, "Setting maxmemory-policy variable to volatile-lru in redis.conf") EEFileUtils.searchreplace(self, "/etc/redis/redis.conf", "# maxmemory-policy volatile-lru", "maxmemory-policy volatile-lru") From 33cc10f72595cdc452f31254dce9d09e7a4328b0 Mon Sep 17 00:00:00 2001 From: Prabuddha Chakraborty Date: Thu, 15 Oct 2015 19:22:31 +0530 Subject: [PATCH 04/12] Update wp-cli version --- ee/core/variables.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ee/core/variables.py b/ee/core/variables.py index 264cdcdb..a0e838c7 100644 --- a/ee/core/variables.py +++ b/ee/core/variables.py @@ -16,7 +16,7 @@ class EEVariables(): # EasyEngine packages versions - ee_wp_cli = "0.20.1" + ee_wp_cli = "0.20.2" ee_adminer = "4.2.1" ee_roundcube = "1.1.3" ee_vimbadmin = "3.0.12" From c582de1b4839bac710d6f2b83e3384854cd5130f Mon Sep 17 00:00:00 2001 From: Prabuddha Chakraborty Date: Fri, 16 Oct 2015 15:37:14 +0530 Subject: [PATCH 05/12] redis_install_flag variable --- ee/cli/plugins/stack.py | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/ee/cli/plugins/stack.py b/ee/cli/plugins/stack.py index c622033a..64da1941 100644 --- a/ee/cli/plugins/stack.py +++ b/ee/cli/plugins/stack.py @@ -1642,7 +1642,6 @@ class EEStackController(CementBaseController): if not EEAptGet.is_installed(self, 'redis-server'): apt_packages = apt_packages + EEVariables.ee_redis self.app.pargs.php = True - redis_install_flag = True else: Log.info(self, "Redis already installed") @@ -1810,18 +1809,10 @@ class EEStackController(CementBaseController): EEDownload.download(self, packages) Log.debug(self, "Calling post_pref") self.post_pref(apt_packages, packages) - if disp_msg: - if len(self.msg): - for msg in self.msg: - Log.info(self, Log.ENDC + msg) - Log.info(self, "Successfully installed packages") - else: - return self.msg - - # set redis.conf parameter - # set maxmemory 10% for ram below 512MB and 20% for others - # set maxmemory-policy volatile-lru - if redis_install_flag: + if 'redis-server' in apt_packages: + # set redis.conf parameter + # set maxmemory 10% for ram below 512MB and 20% for others + # set maxmemory-policy volatile-lru if os.path.isfile("/etc/redis/redis.conf"): if EEVariables.ee_ram < 512: Log.debug(self, "Setting maxmemory variable to {0} in redis.conf" @@ -1829,7 +1820,6 @@ class EEStackController(CementBaseController): EEFileUtils.searchreplace(self, "/etc/redis/redis.conf", "# maxmemory ", "maxmemory {0}".format(int(EEVariables.ee_ram*1024*1024*0.1))) - Log.debug(self, "Setting maxmemory-policy variable to volatile-lru in redis.conf") EEFileUtils.searchreplace(self, "/etc/redis/redis.conf", "# maxmemory-policy volatile-lru", @@ -1846,6 +1836,13 @@ class EEStackController(CementBaseController): "# maxmemory-policy volatile-lru", "maxmemory-policy volatile-lru") EEService.restart_service(self, 'redis-server') + if disp_msg: + if len(self.msg): + for msg in self.msg: + Log.info(self, Log.ENDC + msg) + Log.info(self, "Successfully installed packages") + else: + return self.msg @expose(help="Remove packages") def remove(self): From d173791d3397f8575c68a90ec110b9268d0fe819 Mon Sep 17 00:00:00 2001 From: Prabuddha Chakraborty Date: Fri, 16 Oct 2015 15:55:52 +0530 Subject: [PATCH 06/12] Update version v3.3.10 --- ee/core/variables.py | 2 +- install | 2 +- setup.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ee/core/variables.py b/ee/core/variables.py index a0e838c7..14957ee2 100644 --- a/ee/core/variables.py +++ b/ee/core/variables.py @@ -12,7 +12,7 @@ class EEVariables(): """Intialization of core variables""" # EasyEngine version - ee_version = "3.3.9" + ee_version = "3.3.10" # EasyEngine packages versions diff --git a/install b/install index c55764e5..beb6e436 100644 --- a/install +++ b/install @@ -48,7 +48,7 @@ fi # Define variables for later use ee_branch=$1 readonly ee_version_old="2.2.3" -readonly ee_version_new="3.3.9" +readonly ee_version_new="3.3.10" readonly ee_log_dir=/var/log/ee/ readonly ee_install_log=/var/log/ee/install.log readonly ee_linux_distro=$(lsb_release -i | awk '{print $3}') diff --git a/setup.py b/setup.py index 71e6bf82..82950194 100644 --- a/setup.py +++ b/setup.py @@ -54,7 +54,7 @@ except Exception as e: os.system("git config --global user.email {0}".format(ee_email)) setup(name='ee', - version='3.3.9', + version='3.3.10', description=long_description, long_description=long_description, classifiers=[], From 7dba1ba7a790fff6a2fc3273df8e3ad14b52a5fc Mon Sep 17 00:00:00 2001 From: Prabuddha Chakraborty Date: Fri, 16 Oct 2015 16:05:30 +0530 Subject: [PATCH 07/12] Update CHANGELOG.TXT --- CHANGELOG.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 0eb1dcf4..9ff62093 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,3 +1,7 @@ +v 3.3.10 - Oct 16, 2015 +- Fix #630 +- Updated wp-cli version + v 3.3.9 - Oct 9, 2015 - Fix #625 - Fix #627 From 26a544bb5c33cc515db7b2d51dd0070daad5fc89 Mon Sep 17 00:00:00 2001 From: Prabuddha Chakraborty Date: Fri, 16 Oct 2015 16:34:52 +0530 Subject: [PATCH 08/12] added more option to Travis test --- .travis.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.travis.yml b/.travis.yml index d3f8073d..31228cf1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -83,6 +83,10 @@ script: - sudo ee site create site3.localtest.me --php --html - sudo ee site create site4.localtest.me --wp --wpsubdomain - sudo ee site create site5.localtest.me --wp --wpsubdir --wpfc + - yes | sudo ee site create site6.localtest.me --wpredis + - yes | sudo ee site create site6.localtest.me --wpsubdomain --wpredis + - yes | sudo ee site create site6.localtest.me --wpsubdir --wpredis + - sudo ee debug --all - sudo ee debug --all=off @@ -99,6 +103,7 @@ script: - sudo ee site update site1.com --wp --wpfc - sudo ee site update site1.com --wp --w3tc - sudo ee site update site1.com --wp --wpsc + - yes | sudo ee site update site1.com --wpredis - sudo ee site update site5.com --wpsubdir --wpfc - sudo ee site update site5.com --wpsubdir --w3tc From 20cc26377d58d62cf373d7f089c32226734aadee Mon Sep 17 00:00:00 2001 From: Prabuddha Chakraborty Date: Fri, 16 Oct 2015 16:38:19 +0530 Subject: [PATCH 09/12] added more option to Travis test --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 31228cf1..de3333cd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -84,8 +84,8 @@ script: - sudo ee site create site4.localtest.me --wp --wpsubdomain - sudo ee site create site5.localtest.me --wp --wpsubdir --wpfc - yes | sudo ee site create site6.localtest.me --wpredis - - yes | sudo ee site create site6.localtest.me --wpsubdomain --wpredis - - yes | sudo ee site create site6.localtest.me --wpsubdir --wpredis + - yes | sudo ee site create site7.localtest.me --wpsubdomain --wpredis + - yes | sudo ee site create site8.localtest.me --wpsubdir --wpredis - sudo ee debug --all From ac840ad0bd4db285f93737a7078d8072417ebec1 Mon Sep 17 00:00:00 2001 From: Prabuddha Chakraborty Date: Fri, 16 Oct 2015 18:17:03 +0530 Subject: [PATCH 10/12] Fix #631 --- ee/cli/plugins/site_functions.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ee/cli/plugins/site_functions.py b/ee/cli/plugins/site_functions.py index 6d92448c..2e6a65d3 100644 --- a/ee/cli/plugins/site_functions.py +++ b/ee/cli/plugins/site_functions.py @@ -623,6 +623,17 @@ def sitebackup(self, data): Log.info(self, "[" + Log.ENDC + "Done" + Log.OKBLUE + "]") configfiles = glob.glob(ee_site_webroot + '/*-config.php') + if not configfiles: + #search for wp-config.php inside htdocs/ + Log.debug(self, "Config files not found in {0}/ " + .format(ee_site_webroot)) + if data['currsitetype'] in ['mysql']: + pass + else: + Log.debug(self, "Searching wp-config.php in {0}/htdocs/ " + .format(ee_site_webroot)) + configfiles = glob.glob(ee_site_webroot + '/htdocs/wp-config.php') + # if configfiles and EEFileUtils.isexist(self, configfiles[0]): # ee_db_name = (EEFileUtils.grep(self, configfiles[0], # 'DB_NAME').split(',')[1] From a68e2f09521625f953721c5f7e01ea106b624881 Mon Sep 17 00:00:00 2001 From: Prabuddha Chakraborty Date: Fri, 16 Oct 2015 19:08:39 +0530 Subject: [PATCH 11/12] Update CHANGELOG.txt: --- CHANGELOG.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 9ff62093..0e6a3721 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,5 +1,6 @@ -v 3.3.10 - Oct 16, 2015 +v 3.3.10 - Oct 19, 2015 - Fix #630 +- Fix #631 - Updated wp-cli version v 3.3.9 - Oct 9, 2015 From 4704616153b8614682e1d3c30da151b24a532597 Mon Sep 17 00:00:00 2001 From: Prabuddha Chakraborty Date: Fri, 16 Oct 2015 19:43:16 +0530 Subject: [PATCH 12/12] Fix wp-config path inside htdocs/ --- ee/cli/plugins/site.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/ee/cli/plugins/site.py b/ee/cli/plugins/site.py index 3e393642..78ae6e77 100644 --- a/ee/cli/plugins/site.py +++ b/ee/cli/plugins/site.py @@ -1307,12 +1307,22 @@ class EESiteUpdateController(CementBaseController): if oldcachetype != 'wpredis' and data['wpredis']: try: if installwp_plugin(self, 'redis-cache', data): - if EEShellExec.cmd_exec(self, "grep -q \"WP_CACHE_KEY_SALT\" {0}/wp-config.php" - .format(ee_site_webroot)): + #search for wp-config.php + if EEFileUtils.isexist(self,"{0}/wp-config.php".format(ee_site_webroot)): + config_path = '{0}/wp-config.php'.format(ee_site_webroot) + elif EEFileUtils.isexist(self,"{0}/htdocs/wp-config.php".format(ee_site_webroot)): + config_path = '{0}/htdocs/wp-config.php'.format(ee_site_webroot) + else: + Log.debug(self, "Updating wp-config.php failed. File could not be located.") + Log.error(self,"wp-config.php could not be located !!") + raise SiteError + + if EEShellExec.cmd_exec(self, "grep -q \"WP_CACHE_KEY_SALT\" {0}" + .format(config_path)): pass else: try: - wpconfig = open("{0}/wp-config.php".format(ee_site_webroot), + wpconfig = open("{0}".format(config_path), encoding='utf-8', mode='a') wpconfig.write("\n\ndefine( \'WP_CACHE_KEY_SALT\', \'{0}:\' );" .format(ee_domain))