Debugging and temporary fix for relations purging issue

This commit is contained in:
Dan Stillman 2013-11-13 12:08:44 -05:00
parent 2ca0d159b5
commit 6a0c623698

View File

@ -229,21 +229,27 @@ Zotero.Relations = new function () {
var uris = Zotero.DB.columnQuery(sql, [this.deletedItemPredicate, this.deletedItemPredicate]); var uris = Zotero.DB.columnQuery(sql, [this.deletedItemPredicate, this.deletedItemPredicate]);
if (uris) { if (uris) {
var prefix = Zotero.URI.defaultPrefix; var prefix = Zotero.URI.defaultPrefix;
Zotero.DB.beginTransaction(); try {
for each(var uri in uris) { Zotero.DB.beginTransaction();
// Skip URIs that don't begin with the default prefix, for each(var uri in uris) {
// since they don't correspond to local items // Skip URIs that don't begin with the default prefix,
if (uri.indexOf(prefix) == -1) { // since they don't correspond to local items
continue; if (uri.indexOf(prefix) == -1) {
} continue;
if (uri.indexOf(/\/items\//) != -1 && !Zotero.URI.getURIItem(uri)) { }
this.eraseByURI(uri); if (uri.indexOf(/\/items\//) != -1 && !Zotero.URI.getURIItem(uri)) {
} this.eraseByURI(uri);
if (uri.indexOf(/\/collections\//) != -1 && !Zotero.URI.getURICollection(uri)) { }
this.eraseByURI(uri); if (uri.indexOf(/\/collections\//) != -1 && !Zotero.URI.getURICollection(uri)) {
this.eraseByURI(uri);
}
} }
Zotero.DB.commitTransaction();
}
catch (e) {
Zotero.debug(e);
Zotero.debug(Zotero.DB.query("SELECT * FROM relations"));
} }
Zotero.DB.commitTransaction();
} }
} }