From 840eb3b4ee885d89eaaad5f8d1fe088aa315e60c Mon Sep 17 00:00:00 2001 From: Intelli Date: Sun, 20 Mar 2022 16:37:20 -0600 Subject: [PATCH] Added hidden "disable-wal" database option (default: false) --- src/main/java/net/coreprotect/config/Config.java | 2 ++ src/main/java/net/coreprotect/database/Database.java | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/coreprotect/config/Config.java b/src/main/java/net/coreprotect/config/Config.java index f6f9251..6e9a30b 100644 --- a/src/main/java/net/coreprotect/config/Config.java +++ b/src/main/java/net/coreprotect/config/Config.java @@ -42,6 +42,7 @@ public class Config extends Language { public String MYSQL_PASSWORD; public String LANGUAGE; public boolean ENABLE_AWE; + public boolean DISABLE_WAL; public boolean HOVER_EVENTS; public boolean DATABASE_LOCK; public boolean LOG_CANCELLED_CHAT; @@ -182,6 +183,7 @@ public class Config extends Language { private void readValues() { this.ENABLE_AWE = this.getBoolean("enable-awe", false); + this.DISABLE_WAL = this.getBoolean("disable-wal", false); this.HOVER_EVENTS = this.getBoolean("hover-events", true); this.DATABASE_LOCK = this.getBoolean("database-lock", true); this.LOG_CANCELLED_CHAT = this.getBoolean("log-cancelled-chat", true); diff --git a/src/main/java/net/coreprotect/database/Database.java b/src/main/java/net/coreprotect/database/Database.java index 391692d..da6dd3a 100755 --- a/src/main/java/net/coreprotect/database/Database.java +++ b/src/main/java/net/coreprotect/database/Database.java @@ -302,7 +302,12 @@ public class Database extends Queue { private static void initializeTables(String prefix, Statement statement) { try { if (!Config.getGlobal().MYSQL) { - statement.executeUpdate("PRAGMA journal_mode=WAL;"); + if (!Config.getGlobal().DISABLE_WAL) { + statement.executeUpdate("PRAGMA journal_mode=WAL;"); + } + else { + statement.executeUpdate("PRAGMA journal_mode=DELETE;"); + } } boolean lockInitialized = false;