commit d1ef5431ace7f969252b720851c7c0d289989e0e
parent 91940e11ad5094d040b0058d37ef83e3908d1d8d
Author: Dan Stillman <dstillman@zotero.org>
Date: Tue, 5 Nov 2013 14:27:42 -0500
Back up database before disabling downgrade
Diffstat:
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/chrome/content/zotero/xpcom/db.js b/chrome/content/zotero/xpcom/db.js
@@ -803,7 +803,7 @@ Zotero.DBConnection.prototype.closeDatabase = function () {
}
-Zotero.DBConnection.prototype.backupDatabase = function (suffix) {
+Zotero.DBConnection.prototype.backupDatabase = function (suffix, force) {
if (!suffix) {
var numBackups = Zotero.Prefs.get("backup.numBackups");
if (numBackups < 1) {
@@ -838,7 +838,7 @@ Zotero.DBConnection.prototype.backupDatabase = function (suffix) {
var file = Zotero.getZoteroDatabase(this._dbName);
// For standard backup, make sure last backup is old enough to replace
- if (!suffix) {
+ if (!suffix && !force) {
var backupFile = Zotero.getZoteroDatabase(this._dbName, 'bak');
if (backupFile.exists()) {
var currentDBTime = file.lastModifiedTime;
diff --git a/chrome/content/zotero/xpcom/sync.js b/chrome/content/zotero/xpcom/sync.js
@@ -1398,7 +1398,9 @@ Zotero.Sync.Server = new function () {
// Enable
if (index == 0) {
+ Zotero.DB.backupDatabase(76, true);
Zotero.DB.query("UPDATE version SET version=77 WHERE schema='userdata'");
+ Zotero.wait(1000);
}
// Disable
else {