Disabled the extra integrity check of the temporary shutdown backup file on Windows, since it was preventing zotero.sqlite.tmp from being renamed to zotero.sqlite.bak -- there really needs to be a mozStorage closeDatabase() function

Also addresses #605, Combine alert titles and messages
This commit is contained in:
Dan Stillman 2007-04-07 06:54:02 +00:00
parent a3a8751259
commit 1cb8444a8a

View File

@ -443,7 +443,7 @@ Zotero.DBConnection.prototype.getColumns = function (table) {
Zotero.DBConnection.prototype.getColumnHash = function (table) { Zotero.DBConnection.prototype.getColumnHash = function (table) {
var cols = this.getColumns(table); var cols = this.getColumns(table);
var hash = new Array(); var hash = {};
if (cols.length) { if (cols.length) {
for (var i=0; i<cols.length; i++) { for (var i=0; i<cols.length; i++) {
hash[cols[i]] = true; hash[cols[i]] = true;
@ -518,7 +518,7 @@ Zotero.DBConnection.prototype.getNextName = function (table, field, name)
/* /*
* Shutdown observer * Shutdown observer -- implements nsIObserver
*/ */
Zotero.DBConnection.prototype.observe = function(subject, topic, data) { Zotero.DBConnection.prototype.observe = function(subject, topic, data) {
switch (topic) { switch (topic) {
@ -560,8 +560,8 @@ Zotero.DBConnection.prototype.checkException = function (e) {
+ (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_IS_STRING); + (ps.BUTTON_POS_1) * (ps.BUTTON_TITLE_IS_STRING);
var index = ps.confirmEx(null, var index = ps.confirmEx(null,
Zotero.getString('db.dbCorrupted', this._dbName), Zotero.getString('general.error'),
Zotero.getString('db.dbCorrupted.restart'), Zotero.getString('db.dbCorrupted', this._dbName) + '\n\n' + Zotero.getString('db.dbCorrupted.restart'),
buttonFlags, buttonFlags,
Zotero.getString('general.restartNow'), Zotero.getString('general.restartNow'),
Zotero.getString('general.restartLater'), Zotero.getString('general.restartLater'),
@ -614,15 +614,20 @@ Zotero.DBConnection.prototype.backupDatabase = function () {
throw (e); throw (e);
} }
try { // Opened database files can't be moved on Windows, so we have to skip
var store = Components.classes["@mozilla.org/storage/service;1"]. // the extra integrity check (unless we wanted to write two copies of
getService(Components.interfaces.mozIStorageService); // the database, but that doesn't seem like a great idea)
if (!Zotero.isWin) {
var connection = store.openDatabase(tmpFile); try {
} var store = Components.classes["@mozilla.org/storage/service;1"].
catch (e){ getService(Components.interfaces.mozIStorageService);
this._debug("Database file '" + tmpFile.leafName + "' is corrupt--skipping backup");
return false; var connection = store.openDatabase(tmpFile);
}
catch (e){
this._debug("Database file '" + tmpFile.leafName + "' is corrupt--skipping backup");
return false;
}
} }
// Remove old backup file // Remove old backup file