Limit schema diagnostics to dev builds

This commit is contained in:
Dan Stillman 2020-07-22 18:38:42 -04:00
parent 7f92220ef9
commit 164701450c

View file

@ -1519,35 +1519,37 @@ Zotero.Schema = new function(){
}
// TEMP: DB diagnostics
let badDB = false;
let exists = yield Zotero.DB.tableExists('transactionSets');
url += "&ts=" + (exists ? "1" : "0");
if (exists) {
Zotero.logError("DB table 'transactionSets' still exists");
badDB = true;
}
exists = yield Zotero.DB.tableExists('dbDebug1');
url += "&db1=" + (exists ? "1" : "0");
if (!exists) {
Zotero.logError("DB table 'dbDebug1' does not exist");
badDB = true;
}
if (badDB) {
let cloudDir = Zotero.File.isCloudStorageFolder(Zotero.DataDirectory.dir);
url += "&cd=" + (cloudDir ? "1" : "0");
if (!this._debugDBIntegrityChecked) {
try {
let dbPath = Zotero.DataDirectory.getDatabase();
let dbInfo = yield OS.File.stat(dbPath);
if (dbInfo.size < 500000000) {
let ok = yield Zotero.DB.quickCheck();
url += "&qc=" + (ok ? "1" : "0");
this._debugDBIntegrityChecked = true;
if (Zotero.isDevBuild) {
let badDB = false;
let exists = yield Zotero.DB.tableExists('transactionSets');
url += "&ts=" + (exists ? "1" : "0");
if (exists) {
Zotero.logError("DB table 'transactionSets' still exists");
badDB = true;
}
exists = yield Zotero.DB.tableExists('dbDebug1');
url += "&db1=" + (exists ? "1" : "0");
if (!exists) {
Zotero.logError("DB table 'dbDebug1' does not exist");
badDB = true;
}
if (badDB) {
let cloudDir = Zotero.File.isCloudStorageFolder(Zotero.DataDirectory.dir);
url += "&cd=" + (cloudDir ? "1" : "0");
if (!this._debugDBIntegrityChecked) {
try {
let dbPath = Zotero.DataDirectory.getDatabase();
let dbInfo = yield OS.File.stat(dbPath);
if (dbInfo.size < 500000000) {
let ok = yield Zotero.DB.quickCheck();
url += "&qc=" + (ok ? "1" : "0");
this._debugDBIntegrityChecked = true;
}
}
catch (e) {
Zotero.logError(e);
}
}
catch (e) {
Zotero.logError(e);
}
}
}