Browse Source

added EESync for sync functions

bugfixes
harshadyeola 10 years ago
parent
commit
108b9dc8f9
  1. 2
      ee/cli/plugins/site.py
  2. 67
      ee/cli/plugins/sitedb.py

2
ee/cli/plugins/site.py

@ -20,7 +20,7 @@ def ee_site_hook(app):
from ee.core.database import init_db from ee.core.database import init_db
import ee.cli.plugins.models import ee.cli.plugins.models
init_db(app) init_db(app)
# syncdbinfo() EESync(app).syncdbinfo()
class EESiteController(CementBaseController): class EESiteController(CementBaseController):

67
ee/cli/plugins/sitedb.py

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

Loading…
Cancel
Save