Revert relations purge debugging

This commit is contained in:
Dan Stillman 2013-11-21 20:41:22 -05:00
parent 15710060be
commit 305edd893c

View File

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