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.
This commit is contained in:
parent
d3bc693dab
commit
5c6d9de4b8
1 changed files with 12 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue