|
|
@ -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() |
|
|
|