From 5c6d9de4b8ce626817f3552433d9054520046f06 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Tue, 1 Aug 2006 23:32:18 +0000 Subject: [PATCH] Addresses #77, maintain database backups Temporarily added in a check of the backup file on startup, since I'm not entirely convinced that the backup mechanism on shutdown couldn't create a corrupt file under certain conditions If you run with debug output on and notice the "Backup file was corrupt" message, let me know. --- chrome/chromeFiles/content/scholar/xpcom/db.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/chrome/chromeFiles/content/scholar/xpcom/db.js b/chrome/chromeFiles/content/scholar/xpcom/db.js index 00c315bb8f..7a515e9626 100644 --- a/chrome/chromeFiles/content/scholar/xpcom/db.js +++ b/chrome/chromeFiles/content/scholar/xpcom/db.js @@ -361,6 +361,18 @@ Scholar.DB = new function(){ var file = Scholar.getScholarDatabase(); var backupFile = Scholar.getScholarDatabase('bak'); + // DEBUG: Temporary check + // Test the backup file (to make sure the backup mechanism is working) + if (backupFile.exists()){ + try { + _connection = store.openDatabase(backupFile); + } + catch (e){ + Scholar.debug('Backup file was corrupt', 1); + } + _connection = undefined; + } + catchBlock: try { _connection = store.openDatabase(file); }