Browse Source

Added comments

bugfixes
harshadyeola 10 years ago
parent
commit
06f6a77877
  1. 12
      ee/cli/plugins/sitedb.py
  2. 2
      ee/core/variables.py
  3. 3
      upgrade

12
ee/cli/plugins/sitedb.py

@ -9,7 +9,10 @@ import sys
def addNewSite(self, site, stype, cache, path,
enabled=True, ssl=False, fs='ext4', db=''):
enabled=True, ssl=False, fs='ext4', db='mysql'):
"""
Add New Site record information into ee database.
"""
try:
newRec = SiteDB(site, stype, cache, path, enabled, ssl, fs, db)
db_session.add(newRec)
@ -20,6 +23,9 @@ def addNewSite(self, site, stype, cache, path,
def getSiteInfo(self, site):
"""
Retrieves site record from ee databse
"""
try:
q = SiteDB.query.filter(SiteDB.sitename == site).first()
return q
@ -30,6 +36,7 @@ def getSiteInfo(self, site):
def updateSiteInfo(self, site, stype='', cache='',
enabled=True, ssl=False, fs='', db=''):
"""updates site record in database"""
try:
q = SiteDB.query.filter(SiteDB.sitename == site).first()
except Exception as e:
@ -39,6 +46,7 @@ def updateSiteInfo(self, site, stype='', cache='',
if not q:
Log.error(self, "{0} does not exist in database".format(site))
# Check if new record matches old if not then only update database
if stype and q.site_type != stype:
q.site_type = stype
@ -60,6 +68,7 @@ def updateSiteInfo(self, site, stype='', cache='',
def deleteSiteInfo(self, site):
"""Delete site record in database"""
try:
q = SiteDB.query.filter(SiteDB.sitename == site).first()
except Exception as e:
@ -78,6 +87,7 @@ def deleteSiteInfo(self, site):
def getAllsites(self):
try:
q = SiteDB.query.all()
return q

2
ee/core/variables.py

@ -114,6 +114,8 @@ class EEVariables():
# Repo path
ee_repo_file = "ee-repo.list"
ee_repo_file_path = ("/etc/apt/sources.list.d/" + ee_repo_file)
# Application dabase file path
basedir = os.path.abspath(os.path.dirname('/var/lib/ee/'))
ee_db_uri = 'sqlite:///' + os.path.join(basedir, 'ee.db')

3
upgrade

@ -27,6 +27,7 @@ function sync_db()
{
mkdir /var/lib/ee
# Sqlite query to create table `sites` into ee.db which will be used by ee.3.0
echo "CREATE TABLE sites (
id INTEGER PRIMARY KEY AUTOINCREMENT,
sitename UNIQUE,
@ -112,6 +113,8 @@ function sync_db()
fi
WEBROOT="/var/www/$site"
# Insert query to insert old site information into ee.db
echo "INSERT INTO sites (sitename, site_type, cache_type, site_path, is_enabled, is_ssl, storage_fs, storage_db)
VALUES (\"$site\", \"$EE_SITE_CURRENT\", \"$EE_SITE_CURRENT_CACHE\", \"$WEBROOT\", \"$ENABLE_STATUS\", 0, 'ext4', 'mysql');" | sqlite3 /var/lib/ee/ee.db

Loading…
Cancel
Save