Add missing "MARIADB" datasource backend to the configuration file, remove "mySQLDriverClassName" property as it is no longer needed.

This commit is contained in:
Gabriele C
2022-07-28 18:11:57 +02:00
parent 6d49d798f1
commit 24d03aa1e2
5 changed files with 25 additions and 31 deletions
@@ -6,6 +6,7 @@ import ch.jalu.configme.properties.Property;
import ch.jalu.configme.properties.convertresult.PropertyValue;
import ch.jalu.configme.resource.PropertyReader;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.datasource.DataSourceType;
import fr.xephi.authme.initialization.DataFolder;
import fr.xephi.authme.output.ConsoleLoggerFactory;
import fr.xephi.authme.output.LogLevel;
@@ -65,10 +66,10 @@ public class SettingsMigrationService extends PlainMigrationService {
configurationData.setValue(ALLOWED_NICKNAME_CHARACTERS, "[a-zA-Z0-9_]*");
changes = true;
}
String driverClass = reader.getString(DatabaseSettings.MYSQL_DRIVER_CLASS_NAME.getPath());
if ("com.mysql.jdbc.Driver".equals(driverClass) || "com.mysql.cj.jdbc.Driver".equals(driverClass)) {
configurationData.setValue(DatabaseSettings.MYSQL_DRIVER_CLASS_NAME,
DatabaseSettings.MYSQL_DRIVER_CLASS_NAME.getDefaultValue());
String driverClass = reader.getString("DataSource.mySQLDriverClassName");
if ("fr.xephi.authme.libs.org.mariadb.jdbc.Driver".equals(driverClass)) {
configurationData.setValue(DatabaseSettings.BACKEND, DataSourceType.MARIADB);
changes = true;
}
@@ -100,7 +101,7 @@ public class SettingsMigrationService extends PlainMigrationService {
"settings.restrictions.keepCollisionsDisabled", "settings.forceCommands", "settings.forceCommandsAsConsole",
"settings.forceRegisterCommands", "settings.forceRegisterCommandsAsConsole",
"settings.sessions.sessionExpireOnIpChange", "settings.restrictions.otherAccountsCmd",
"settings.restrictions.otherAccountsCmdThreshold"};
"settings.restrictions.otherAccountsCmdThreshold, DataSource.mySQLDriverClassName"};
for (String deprecatedPath : deprecatedProperties) {
if (reader.contains(deprecatedPath)) {
return true;
@@ -10,7 +10,7 @@ import static ch.jalu.configme.properties.PropertyInitializer.newProperty;
public final class DatabaseSettings implements SettingsHolder {
@Comment({"What type of database do you want to use?",
"Valid values: SQLITE, MYSQL, POSTGRESQL"})
"Valid values: SQLITE, MARIADB, MYSQL, POSTGRESQL"})
public static final Property<DataSourceType> BACKEND =
newProperty(DataSourceType.class, "DataSource.backend", DataSourceType.SQLITE);
@@ -49,13 +49,6 @@ public final class DatabaseSettings implements SettingsHolder {
@Comment("Password to connect to the MySQL database")
public static final Property<String> MYSQL_PASSWORD =
newProperty("DataSource.mySQLPassword", "12345");
@Comment({"Driver Name of the MySQL database.",
"Built-in drivers:",
" MySQL: 'fr.xephi.authme.libs.com.mysql.cj.jdbc.Driver'",
" MariaDB: 'fr.xephi.authme.libs.org.mariadb.jdbc.Driver'"})
public static final Property<String> MYSQL_DRIVER_CLASS_NAME =
newProperty("DataSource.mySQLDriverClassName", "fr.xephi.authme.libs.com.mysql.cj.jdbc.Driver");
@Comment("Database Name, use with converters or as SQLITE database name")
public static final Property<String> MYSQL_DATABASE =