Modlog: Minor fixes from smogtours conversion

This commit is contained in:
Annika 2021-09-06 17:54:30 -04:00 committed by Guangcong Luo
parent a735d1fa54
commit 055a01ab89
2 changed files with 4 additions and 2 deletions

View File

@ -145,9 +145,10 @@ export class Modlog {
if (hasDBInfo === 0) {
// needs v2 migration
Monitor.warn(`The modlog database is being migrated to version 2; this may take a while.`);
const warnFunction = ('Monitor' in global && Monitor.warn) ? Monitor.warn : console.log;
warnFunction(`The modlog database is being migrated to version 2; this may take a while.`);
await this.database.runFile(MODLOG_V2_MIGRATION_PATH);
Monitor.warn(`Modlog database migration complete.`);
warnFunction(`Modlog database migration complete.`);
}
this.modlogInsertionQuery = await this.database.prepare(

View File

@ -636,6 +636,7 @@ export class ModlogConverterTxt {
}
async toSQLite() {
await this.modlog.readyPromise;
const files = this.isTesting ? [...this.isTesting.files.keys()] : await FS(this.textLogDir).readdir();
// Read global modlog first to avoid inserting duplicate data to database
if (files.includes('modlog_global.txt')) {