Skip to content

Commit 4704616

Browse files
committed
Fix wp-config path inside htdocs/
1 parent a68e2f0 commit 4704616

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

ee/cli/plugins/site.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1307,12 +1307,22 @@ def doupdatesite(self, pargs):
13071307
if oldcachetype != 'wpredis' and data['wpredis']:
13081308
try:
13091309
if installwp_plugin(self, 'redis-cache', data):
1310-
if EEShellExec.cmd_exec(self, "grep -q \"WP_CACHE_KEY_SALT\" {0}/wp-config.php"
1311-
.format(ee_site_webroot)):
1310+
#search for wp-config.php
1311+
if EEFileUtils.isexist(self,"{0}/wp-config.php".format(ee_site_webroot)):
1312+
config_path = '{0}/wp-config.php'.format(ee_site_webroot)
1313+
elif EEFileUtils.isexist(self,"{0}/htdocs/wp-config.php".format(ee_site_webroot)):
1314+
config_path = '{0}/htdocs/wp-config.php'.format(ee_site_webroot)
1315+
else:
1316+
Log.debug(self, "Updating wp-config.php failed. File could not be located.")
1317+
Log.error(self,"wp-config.php could not be located !!")
1318+
raise SiteError
1319+
1320+
if EEShellExec.cmd_exec(self, "grep -q \"WP_CACHE_KEY_SALT\" {0}"
1321+
.format(config_path)):
13121322
pass
13131323
else:
13141324
try:
1315-
wpconfig = open("{0}/wp-config.php".format(ee_site_webroot),
1325+
wpconfig = open("{0}".format(config_path),
13161326
encoding='utf-8', mode='a')
13171327
wpconfig.write("\n\ndefine( \'WP_CACHE_KEY_SALT\', \'{0}:\' );"
13181328
.format(ee_domain))

0 commit comments

Comments
 (0)