mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-07-22 06:29:17 -04:00
Revert "feat: structured logging (JSON)" (#5175)
This commit is contained in:
parent
4829ad8c5d
commit
eca90a2b00
27 changed files with 239 additions and 186 deletions
|
@ -1,11 +1,11 @@
|
|||
const fs = require("fs");
|
||||
const { R } = require("redbean-node");
|
||||
const { setSetting, setting } = require("./util-server");
|
||||
const { log, sleep } = require("../src/util");
|
||||
const knex = require("knex");
|
||||
const path = require("path");
|
||||
const { EmbeddedMariaDB } = require("./embedded-mariadb");
|
||||
const mysql = require("mysql2/promise");
|
||||
const { Settings } = require("./settings");
|
||||
|
||||
/**
|
||||
* Database & App Data Folder
|
||||
|
@ -420,7 +420,7 @@ class Database {
|
|||
* @deprecated
|
||||
*/
|
||||
static async patchSqlite() {
|
||||
let version = parseInt(await Settings.get("database_version"));
|
||||
let version = parseInt(await setting("database_version"));
|
||||
|
||||
if (! version) {
|
||||
version = 0;
|
||||
|
@ -445,7 +445,7 @@ class Database {
|
|||
log.info("db", `Patching ${sqlFile}`);
|
||||
await Database.importSQLFile(sqlFile);
|
||||
log.info("db", `Patched ${sqlFile}`);
|
||||
await Settings.set("database_version", i);
|
||||
await setSetting("database_version", i);
|
||||
}
|
||||
} catch (ex) {
|
||||
await Database.close();
|
||||
|
@ -471,7 +471,7 @@ class Database {
|
|||
*/
|
||||
static async patchSqlite2() {
|
||||
log.debug("db", "Database Patch 2.0 Process");
|
||||
let databasePatchedFiles = await Settings.get("databasePatchedFiles");
|
||||
let databasePatchedFiles = await setting("databasePatchedFiles");
|
||||
|
||||
if (! databasePatchedFiles) {
|
||||
databasePatchedFiles = {};
|
||||
|
@ -499,7 +499,7 @@ class Database {
|
|||
process.exit(1);
|
||||
}
|
||||
|
||||
await Settings.set("databasePatchedFiles", databasePatchedFiles);
|
||||
await setSetting("databasePatchedFiles", databasePatchedFiles);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -512,27 +512,27 @@ class Database {
|
|||
// Fix 1.13.0 empty slug bug
|
||||
await R.exec("UPDATE status_page SET slug = 'empty-slug-recover' WHERE TRIM(slug) = ''");
|
||||
|
||||
let title = await Settings.get("title");
|
||||
let title = await setting("title");
|
||||
|
||||
if (title) {
|
||||
log.info("database", "Migrating Status Page");
|
||||
console.log("Migrating Status Page");
|
||||
|
||||
let statusPageCheck = await R.findOne("status_page", " slug = 'default' ");
|
||||
|
||||
if (statusPageCheck !== null) {
|
||||
log.info("database", "Migrating Status Page - Skip, default slug record is already existing");
|
||||
console.log("Migrating Status Page - Skip, default slug record is already existing");
|
||||
return;
|
||||
}
|
||||
|
||||
let statusPage = R.dispense("status_page");
|
||||
statusPage.slug = "default";
|
||||
statusPage.title = title;
|
||||
statusPage.description = await Settings.get("description");
|
||||
statusPage.icon = await Settings.get("icon");
|
||||
statusPage.theme = await Settings.get("statusPageTheme");
|
||||
statusPage.published = !!await Settings.get("statusPagePublished");
|
||||
statusPage.search_engine_index = !!await Settings.get("searchEngineIndex");
|
||||
statusPage.show_tags = !!await Settings.get("statusPageTags");
|
||||
statusPage.description = await setting("description");
|
||||
statusPage.icon = await setting("icon");
|
||||
statusPage.theme = await setting("statusPageTheme");
|
||||
statusPage.published = !!await setting("statusPagePublished");
|
||||
statusPage.search_engine_index = !!await setting("searchEngineIndex");
|
||||
statusPage.show_tags = !!await setting("statusPageTags");
|
||||
statusPage.password = null;
|
||||
|
||||
if (!statusPage.title) {
|
||||
|
@ -560,13 +560,13 @@ class Database {
|
|||
await R.exec("DELETE FROM setting WHERE type = 'statusPage'");
|
||||
|
||||
// Migrate Entry Page if it is status page
|
||||
let entryPage = await Settings.get("entryPage");
|
||||
let entryPage = await setting("entryPage");
|
||||
|
||||
if (entryPage === "statusPage") {
|
||||
await Settings.set("entryPage", "statusPage-default", "general");
|
||||
await setSetting("entryPage", "statusPage-default", "general");
|
||||
}
|
||||
|
||||
log.info("database", "Migrating Status Page - Done");
|
||||
console.log("Migrating Status Page - Done");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue