Only start dummy statement when backup completes if it was running before backup. Fixes broken upgrades in 2.1b3.

This commit is contained in:
Simon Kornblith 2011-01-14 20:28:29 +00:00
parent a709b779a7
commit 06e446a527

View file

@ -852,11 +852,14 @@ Zotero.DBConnection.prototype.backupDatabase = function (suffix) {
// Turn off DB locking before backup and reenable after, since otherwise
// the lock is lost
var dbLockExclusive = Zotero.Prefs.get('dbLockExclusive');
var hadDummyStatement = !!this._dummyStatement;
try {
if (dbLockExclusive) {
Zotero.DB.query("PRAGMA locking_mode=NORMAL");
}
if (hadDummyStatement) {
Zotero.DB.stopDummyStatement();
}
var store = Components.classes["@mozilla.org/storage/service;1"].
getService(Components.interfaces.mozIStorageService);
@ -871,8 +874,10 @@ Zotero.DBConnection.prototype.backupDatabase = function (suffix) {
if (dbLockExclusive) {
Zotero.DB.query("PRAGMA locking_mode=EXCLUSIVE");
}
if (hadDummyStatement) {
Zotero.DB.startDummyStatement();
}
}
// Opened database files can't be moved on Windows, so we have to skip
// the extra integrity check (unless we wanted to write two copies of