(self, path)
| 10 | @PluginManager.acceptPlugins |
| 11 | class ContentDb(Db): |
| 12 | def __init__(self, path): |
| 13 | Db.__init__(self, {"db_name": "ContentDb", "tables": {}}, path) |
| 14 | self.foreign_keys = True |
| 15 | try: |
| 16 | self.schema = self.getSchema() |
| 17 | try: |
| 18 | self.checkTables() |
| 19 | except DbTableError: |
| 20 | pass |
| 21 | self.log.debug("Checking foreign keys...") |
| 22 | foreign_key_error = self.execute("PRAGMA foreign_key_check").fetchone() |
| 23 | if foreign_key_error: |
| 24 | raise Exception("Database foreign key error: %s" % foreign_key_error) |
| 25 | except Exception as err: |
| 26 | self.log.error("Error loading content.db: %s, rebuilding..." % Debug.formatException(err)) |
| 27 | self.close() |
| 28 | os.unlink(path) # Remove and try again |
| 29 | Db.__init__(self, {"db_name": "ContentDb", "tables": {}}, path) |
| 30 | self.foreign_keys = True |
| 31 | self.schema = self.getSchema() |
| 32 | try: |
| 33 | self.checkTables() |
| 34 | except DbTableError: |
| 35 | pass |
| 36 | self.site_ids = {} |
| 37 | self.sites = {} |
| 38 | |
| 39 | def getSchema(self): |
| 40 | schema = {} |
nothing calls this directly
no test coverage detected