Commit d4a5bf5a authored by Mikaël Salson's avatar Mikaël Salson Committed by Vidjil Team
Browse files

controllers/admin.py: Split database backup so that the function can be used externally

parent feef93d6
......@@ -132,10 +132,13 @@ def repair_missing_files():
return gluon.contrib.simplejson.dumps(res, separators=(',',':'))
def backup_database(stream):
db.export_to_csv_file(stream)
def make_backup():
if auth.is_admin():
db.export_to_csv_file(open(defs.DB_BACKUP_FILE, 'wb'))
backup_database(open(defs.DB_BACKUP_FILE, 'wb'))
res = {"success" : "true", "message" : "DB backup -> %s" % defs.DB_BACKUP_FILE}
log.admin(res)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment