More debug info for incomplete schema upgrades

Include info on whether the data directory is in a cloud storage folder
and whether the DB passes a quick integrity check.
This commit is contained in:
Dan Stillman 2020-06-21 05:23:05 -04:00
parent b4320fbc4c
commit 1ec2615eee

View file

@ -1515,15 +1515,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;
}
}
catch (e) {
Zotero.logError(e);
}
}
}
// Send list of installed styles