Rev1909, Rebuild content.db on error
This commit is contained in:
parent
f5fb6b83ff
commit
23dc8e063c
2 changed files with 12 additions and 3 deletions
|
@ -10,7 +10,7 @@ class Config(object):
|
||||||
|
|
||||||
def __init__(self, argv):
|
def __init__(self, argv):
|
||||||
self.version = "0.5.2"
|
self.version = "0.5.2"
|
||||||
self.rev = 1905
|
self.rev = 1909
|
||||||
self.argv = argv
|
self.argv = argv
|
||||||
self.action = None
|
self.action = None
|
||||||
self.config_file = "zeronet.conf"
|
self.config_file = "zeronet.conf"
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
import time
|
import time
|
||||||
|
import os
|
||||||
|
|
||||||
from Db import Db
|
from Db import Db
|
||||||
from Config import config
|
from Config import config
|
||||||
from Plugin import PluginManager
|
from Plugin import PluginManager
|
||||||
|
from Debug import Debug
|
||||||
|
|
||||||
|
|
||||||
@PluginManager.acceptPlugins
|
@PluginManager.acceptPlugins
|
||||||
|
@ -10,8 +12,15 @@ class ContentDb(Db):
|
||||||
def __init__(self, path):
|
def __init__(self, path):
|
||||||
Db.__init__(self, {"db_name": "ContentDb", "tables": {}}, path)
|
Db.__init__(self, {"db_name": "ContentDb", "tables": {}}, path)
|
||||||
self.foreign_keys = True
|
self.foreign_keys = True
|
||||||
self.schema = self.getSchema()
|
try:
|
||||||
self.checkTables()
|
self.schema = self.getSchema()
|
||||||
|
self.checkTables()
|
||||||
|
except Exception, err:
|
||||||
|
self.log.error("Error loading content.db: %s, rebuilding..." % Debug.formatException(err))
|
||||||
|
self.close()
|
||||||
|
os.unlink(path) # Remove and try again
|
||||||
|
self.schema = self.getSchema()
|
||||||
|
self.checkTables()
|
||||||
self.site_ids = {}
|
self.site_ids = {}
|
||||||
self.sites = {}
|
self.sites = {}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue