Rev1905, Secure DB write db_mode option
This commit is contained in:
parent
3d55af2111
commit
f5fb6b83ff
2 changed files with 8 additions and 4 deletions
|
@ -10,7 +10,7 @@ class Config(object):
|
|||
|
||||
def __init__(self, argv):
|
||||
self.version = "0.5.2"
|
||||
self.rev = 1899
|
||||
self.rev = 1905
|
||||
self.argv = argv
|
||||
self.action = None
|
||||
self.config_file = "zeronet.conf"
|
||||
|
@ -206,6 +206,7 @@ class Config(object):
|
|||
type='bool', choices=[True, False], default=True)
|
||||
self.parser.add_argument("--fix_float_decimals", help='Fix content.json modification date float precision on verification',
|
||||
type='bool', choices=[True, False], default=fix_float_decimals)
|
||||
self.parser.add_argument("--db_mode", choices=["speed", "security"], default="speed")
|
||||
|
||||
self.parser.add_argument('--coffeescript_compiler', help='Coffeescript compiler for developing', default=coffeescript,
|
||||
metavar='executable_path')
|
||||
|
|
|
@ -59,9 +59,12 @@ class Db(object):
|
|||
self.conn.row_factory = sqlite3.Row
|
||||
self.conn.isolation_level = None
|
||||
self.cur = self.getCursor()
|
||||
# We need more speed then security
|
||||
self.cur.execute("PRAGMA journal_mode = MEMORY")
|
||||
self.cur.execute("PRAGMA synchronous = OFF")
|
||||
if config.db_mode == "security":
|
||||
self.cur.execute("PRAGMA journal_mode = WAL")
|
||||
self.cur.execute("PRAGMA synchronous = NORMAL")
|
||||
else:
|
||||
self.cur.execute("PRAGMA journal_mode = MEMORY")
|
||||
self.cur.execute("PRAGMA synchronous = OFF")
|
||||
if self.foreign_keys:
|
||||
self.execute("PRAGMA foreign_keys = ON")
|
||||
self.log.debug(
|
||||
|
|
Loading…
Reference in a new issue