From 542dc7a800481e212f011373b50abf3ed999be61 Mon Sep 17 00:00:00 2001 From: Joriom Date: Tue, 30 Sep 2014 20:43:00 +0200 Subject: [PATCH] Fix for phpBB3 support + bonus username_clean PhpBB3 requires second column (username_clen) with username as table primary key. Yet, config value "mySQLOtherUsernameColumns" is not an option as this value needs to be formated with phpBB custom utf8_clean_string() function which brings letters to lower case, merges nearby spaces and removes invalid UTF8 chatacters. Due to characters already being limited both in config and in minecraft itself I believe toLowerCaste() will suffice for now. num_users Increment users count not to loose those nice statistics! --- src/main/java/fr/xephi/authme/datasource/MySQLThread.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/fr/xephi/authme/datasource/MySQLThread.java b/src/main/java/fr/xephi/authme/datasource/MySQLThread.java index e1cce2e68..929f6cd03 100644 --- a/src/main/java/fr/xephi/authme/datasource/MySQLThread.java +++ b/src/main/java/fr/xephi/authme/datasource/MySQLThread.java @@ -286,6 +286,11 @@ public class MySQLThread extends Thread implements DataSource { pst.setInt(3, 0); pst.setInt(4, 0); pst.executeUpdate(); + // Update username_clean in phpbb_users + pst = con.prepareStatement("UPDATE " + tableName + " SET " + tableName + ".username_clean=? WHERE " + columnName + "=?;"); + pst.setString(1, auth.getNickname().toLowerCase()); + pst.setString(2, auth.getNickname()); + pst.executeUpdate(); // Update player group in phpbb_users pst = con.prepareStatement("UPDATE " + tableName + " SET " + tableName + ".group_id=? WHERE " + columnName + "=?;"); pst.setInt(1, Settings.getPhpbbGroup); @@ -303,6 +308,9 @@ public class MySQLThread extends Thread implements DataSource { pst.setLong(1, time); pst.setString(2, auth.getNickname()); pst.executeUpdate(); + // Increment num_users + pst = con.prepareStatement("UPDATE " + Settings.getPhpbbPrefix + "config SET config_value = config_value + 1 WHERE config_name = 'num_users';"); + pst.executeUpdate(); } } if (Settings.getPasswordHash == HashAlgorithm.WORDPRESS) {