Browse Source

modified functions to access ee database

bugfixes
harshadyeola 10 years ago
parent
commit
89516f74c7
  1. 6
      ee/cli/plugins/site_functions.py
  2. 27
      ee/cli/plugins/sitedb.py

6
ee/cli/plugins/site_functions.py

@ -359,7 +359,8 @@ def setupwordpressnetwork(self, data):
def installwp_plugin(self, plugin_name, data):
ee_site_webroot = data['webroot']
Log.info(self, "Installing plugin {0}".format(plugin_name))
Log.info(self, "Installing plugin {0}, please wait ..."
.format(plugin_name))
EEFileUtils.chdir(self, '{0}/htdocs/'.format(ee_site_webroot))
EEShellExec.cmd_exec(self, "php /usr/bin/wp plugin --allow-root install "
"{0}".format(plugin_name),
@ -376,7 +377,8 @@ def installwp_plugin(self, plugin_name, data):
def uninstallwp_plugin(self, plugin_name, data):
ee_site_webroot = data['webroot']
Log.debug(self, "Uninstalling plugin {0}".format(plugin_name))
Log.debug(self, "Uninstalling plugin {0}, please wait ..."
.format(plugin_name))
EEFileUtils.chdir(self, '{0}/htdocs/'.format(ee_site_webroot))
EEShellExec.cmd_exec(self, "php /usr/bin/wp plugin --allow-root uninstall "
"{0}".format(plugin_name),

27
ee/cli/plugins/sitedb.py

@ -9,12 +9,15 @@ import sys
def addNewSite(self, site, stype, cache, path,
enabled=True, ssl=False, fs='ext4', db='mysql'):
enabled=True, ssl=False, fs='ext4', db='mysql',
db_name=None, db_user=None, db_password=None,
db_host='localhost'):
"""
Add New Site record information into ee database.
"""
try:
newRec = SiteDB(site, stype, cache, path, enabled, ssl, fs, db)
newRec = SiteDB(site, stype, cache, path, enabled, ssl, fs, db,
db_name, db_user, db_password, db_host)
db_session.add(newRec)
db_session.commit()
except Exception as e:
@ -34,8 +37,9 @@ def getSiteInfo(self, site):
Log.error(self, "Unable to query database for site info")
def updateSiteInfo(self, site, stype='', cache='',
enabled=True, ssl=False, fs='', db=''):
def updateSiteInfo(self, site, stype='', cache='', webroot='',
enabled=True, ssl=False, fs='', db='', db_name=None,
db_user=None, db_password=None, db_host=None):
"""updates site record in database"""
try:
q = SiteDB.query.filter(SiteDB.sitename == site).first()
@ -59,6 +63,21 @@ def updateSiteInfo(self, site, stype='', cache='',
if ssl and q.is_ssl != ssl:
q.is_ssl = ssl
if db_name and q.db_name != db_name:
q.db_name = db_name
if db_user and q.db_user != db_user:
q.db_user = db_user
if db_user and q.db_password != db_password:
q.db_password = db_password
if db_host and q.db_host != db_host:
q.db_host = db_host
if webroot and q.site_path != webroot:
q.site_path = webroot
try:
q.created_on = func.now()
db_session.commit()

Loading…
Cancel
Save