Back up database before disabling downgrade

This commit is contained in:
Dan Stillman 2013-11-05 14:27:42 -05:00
parent 91940e11ad
commit d1ef5431ac
2 changed files with 4 additions and 2 deletions

View file

@ -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;

View file

@ -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 {