Fix database backup on userdata upgrade
Also uncomment standard backup age tests
This commit is contained in:
parent
e2d3cc3f0d
commit
27804bb47c
2 changed files with 7 additions and 4 deletions
|
@ -624,6 +624,9 @@ Zotero.DBConnection.prototype.executeTransaction = Zotero.Promise.coroutine(func
|
||||||
|
|
||||||
|
|
||||||
Zotero.DBConnection.prototype.waitForTransaction = function () {
|
Zotero.DBConnection.prototype.waitForTransaction = function () {
|
||||||
|
if (!this._transactionPromise) {
|
||||||
|
return Zotero.Promise.resolve();
|
||||||
|
}
|
||||||
Zotero.debug("Waiting for transaction to finish");
|
Zotero.debug("Waiting for transaction to finish");
|
||||||
return this._transactionPromise.then(function () {
|
return this._transactionPromise.then(function () {
|
||||||
Zotero.debug("Done waiting for transaction");
|
Zotero.debug("Done waiting for transaction");
|
||||||
|
@ -955,7 +958,7 @@ Zotero.DBConnection.prototype.backupDatabase = Zotero.Promise.coroutine(function
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Zotero.locked) {
|
if (Zotero.locked && !force) {
|
||||||
this._debug("Zotero is locked -- skipping backup of DB '" + this._dbName + "'", 2);
|
this._debug("Zotero is locked -- skipping backup of DB '" + this._dbName + "'", 2);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -987,7 +990,7 @@ Zotero.DBConnection.prototype.backupDatabase = Zotero.Promise.coroutine(function
|
||||||
var file = Zotero.getZoteroDatabase(this._dbName);
|
var file = Zotero.getZoteroDatabase(this._dbName);
|
||||||
|
|
||||||
// For standard backup, make sure last backup is old enough to replace
|
// For standard backup, make sure last backup is old enough to replace
|
||||||
/*if (!suffix && !force) {
|
if (!suffix && !force) {
|
||||||
var backupFile = Zotero.getZoteroDatabase(this._dbName, 'bak');
|
var backupFile = Zotero.getZoteroDatabase(this._dbName, 'bak');
|
||||||
if (yield OS.File.exists(backupFile.path)) {
|
if (yield OS.File.exists(backupFile.path)) {
|
||||||
var currentDBTime = (yield OS.File.stat(file.path)).lastModificationDate;
|
var currentDBTime = (yield OS.File.stat(file.path)).lastModificationDate;
|
||||||
|
@ -1006,7 +1009,7 @@ Zotero.DBConnection.prototype.backupDatabase = Zotero.Promise.coroutine(function
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
|
|
||||||
this._debug("Backing up database '" + this._dbName + "'");
|
this._debug("Backing up database '" + this._dbName + "'");
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,7 @@ Zotero.Schema = new function(){
|
||||||
// If upgrading userdata, make backup of database first
|
// If upgrading userdata, make backup of database first
|
||||||
.then(function (schemaVersion) {
|
.then(function (schemaVersion) {
|
||||||
if (userdata < schemaVersion) {
|
if (userdata < schemaVersion) {
|
||||||
return Zotero.DB.backupDatabase(userdata);
|
return Zotero.DB.backupDatabase(userdata, true);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.then(function () {
|
.then(function () {
|
||||||
|
|
Loading…
Reference in a new issue