Fix for "Invalid integer value 'Not found' [QUERY: REPLACE INTO version VALUES ('storage_zfs', ?)]"

This commit is contained in:
Dan Stillman 2009-09-16 03:37:14 +00:00
parent e4fd15c228
commit 5be1b75b2b
2 changed files with 26 additions and 8 deletions

View file

@ -591,10 +591,15 @@ Zotero.Sync.Storage.Session.WebDAV.prototype.getLastSyncTime = function (callbac
return; return;
} }
var lastModified = req.getResponseHeader("Last-Modified"); if (req.status == 200) {
var date = new Date(lastModified); var lastModified = req.getResponseHeader("Last-Modified");
Zotero.debug("Last successful storage sync was " + date); var date = new Date(lastModified);
ts = Zotero.Date.toUnixTimestamp(date); Zotero.debug("Last successful storage sync was " + date);
ts = Zotero.Date.toUnixTimestamp(date);
}
else {
ts = null;
}
} }
finally { finally {
callback(ts); callback(ts);

View file

@ -715,10 +715,16 @@ Zotero.Sync.Storage.Session.ZFS.prototype.getLastSyncTime = function (callback)
return; return;
} }
var ts = req.responseText; if (req.status == 200) {
var date = new Date(req.responseText * 1000); var ts = req.responseText;
Zotero.debug("Last successful storage sync was " + date); var date = new Date(req.responseText * 1000);
self._lastSyncTime = ts; Zotero.debug("Last successful storage sync was " + date);
self._lastSyncTime = ts;
}
else {
var ts = null;
self._lastSyncTime = null;
}
callback(ts); callback(ts);
}); });
} }
@ -726,6 +732,13 @@ Zotero.Sync.Storage.Session.ZFS.prototype.getLastSyncTime = function (callback)
Zotero.Sync.Storage.Session.ZFS.prototype.setLastSyncTime = function (callback, useLastSyncTime) { Zotero.Sync.Storage.Session.ZFS.prototype.setLastSyncTime = function (callback, useLastSyncTime) {
if (useLastSyncTime) { if (useLastSyncTime) {
if (!this._lastSyncTime) {
if (callback) {
callback();
}
return;
}
var sql = "REPLACE INTO version VALUES ('storage_zfs', ?)"; var sql = "REPLACE INTO version VALUES ('storage_zfs', ?)";
Zotero.DB.query(sql, { int: this._lastSyncTime }); Zotero.DB.query(sql, { int: this._lastSyncTime });