|
@ -117,34 +117,34 @@ def getAllsites(self): |
|
|
Log.error(self, "Unable to query database") |
|
|
Log.error(self, "Unable to query database") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def syncdbinfo(self): |
|
|
# def syncdbinfo(self): |
|
|
sites = getAllsites(self) |
|
|
# sites = getAllsites(self) |
|
|
if not sites: |
|
|
# if not sites: |
|
|
pass |
|
|
# pass |
|
|
for site in sites: |
|
|
# for site in sites: |
|
|
if site.site_type in ['mysql', 'wp', 'wpsubdir', 'wpsubdomain']: |
|
|
# if site.site_type in ['mysql', 'wp', 'wpsubdir', 'wpsubdomain']: |
|
|
ee_site_webroot = site.site_path |
|
|
# ee_site_webroot = site.site_path |
|
|
configfiles = glob.glob(ee_site_webroot + '/*-config.php') |
|
|
# configfiles = glob.glob(ee_site_webroot + '/*-config.php') |
|
|
if configfiles: |
|
|
# if configfiles: |
|
|
if EEFileUtils.isexist(self, configfiles[0]): |
|
|
# if EEFileUtils.isexist(self, configfiles[0]): |
|
|
ee_db_name = (EEFileUtils.grep(self, configfiles[0], |
|
|
# ee_db_name = (EEFileUtils.grep(self, configfiles[0], |
|
|
'DB_NAME').split(',')[1] |
|
|
# 'DB_NAME').split(',')[1] |
|
|
.split(')')[0].strip().replace('\'', '')) |
|
|
# .split(')')[0].strip().replace('\'', '')) |
|
|
ee_db_user = (EEFileUtils.grep(self, configfiles[0], |
|
|
# ee_db_user = (EEFileUtils.grep(self, configfiles[0], |
|
|
'DB_USER').split(',')[1] |
|
|
# 'DB_USER').split(',')[1] |
|
|
.split(')')[0].strip().replace('\'', '')) |
|
|
# .split(')')[0].strip().replace('\'', '')) |
|
|
ee_db_pass = (EEFileUtils.grep(self, configfiles[0], |
|
|
# ee_db_pass = (EEFileUtils.grep(self, configfiles[0], |
|
|
'DB_PASSWORD').split(',')[1] |
|
|
# 'DB_PASSWORD').split(',')[1] |
|
|
.split(')')[0].strip().replace('\'', '')) |
|
|
# .split(')')[0].strip().replace('\'', '')) |
|
|
ee_db_host = (EEFileUtils.grep(self, configfiles[0], |
|
|
# ee_db_host = (EEFileUtils.grep(self, configfiles[0], |
|
|
'DB_HOST').split(',')[1] |
|
|
# 'DB_HOST').split(',')[1] |
|
|
.split(')')[0].strip().replace('\'', '')) |
|
|
# .split(')')[0].strip().replace('\'', '')) |
|
|
|
|
|
# |
|
|
if site.db_name != ee_db_name: |
|
|
# if site.db_name != ee_db_name: |
|
|
app.log.debug("Updating {0}" |
|
|
# app.log.debug("Updating {0}" |
|
|
.format(site.sitename)) |
|
|
# .format(site.sitename)) |
|
|
updateSiteInfo(self, site.sitename, |
|
|
# updateSiteInfo(self, site.sitename, |
|
|
db_name=ee_db_name, |
|
|
# db_name=ee_db_name, |
|
|
db_user=ee_db_user, |
|
|
# db_user=ee_db_user, |
|
|
db_password=ee_db_pass, |
|
|
# db_password=ee_db_pass, |
|
|
db_host=ee_db_host) |
|
|
# db_host=ee_db_host) |
|
|