Skip to content

Commit

Permalink
Rename db_group_table -> db_user_group_table since it's more accurate.
Browse files Browse the repository at this point in the history
Backport of b14a4b1
  • Loading branch information
Pentarctagon committed Aug 26, 2019
1 parent 9f40471 commit b2d85bb
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion doc/man/wesnothd.6
Expand Up @@ -247,7 +247,7 @@ section is present in the configuration the server will run without any nick reg
.B db_game_modification_info_table
(for user_handler=forum) The name of the table in which wesnothd will save its own data about the modifications used in a game.
.TP
.B db_group_table
.B db_user_group_table
(for user_handler=forum) The name of the table in which your phpbb forums saves its user group data. Most likely this will be <table-prefix>_user_group (e.g. phpbb3_user_group).
.TP
.B mp_mod_group
Expand Down
4 changes: 2 additions & 2 deletions src/server/forum_user_handler.cpp
Expand Up @@ -45,7 +45,7 @@ fuh::fuh(const config& c)
, db_game_info_table_(c["db_game_info_table"].str())
, db_game_player_info_table_(c["db_game_player_info_table"].str())
, db_game_modification_info_table_(c["db_game_modification_info_table"].str())
, db_group_table_(c["db_group_table"].str())
, db_user_group_table_(c["db_user_group_table"].str())
, mp_mod_group_(0)
, conn(mysql_init(nullptr))
{
Expand Down Expand Up @@ -416,7 +416,7 @@ void fuh::write_detail(const std::string& name, const std::string& detail, T&& v

bool fuh::is_user_in_group(const std::string& name, unsigned int group_id) {
try {
return prepared_statement<bool>("SELECT 1 FROM `" + db_users_table_ + "` u, `" + db_group_table_ + "` ug WHERE UPPER(u.username)=UPPER(?) AND u.USER_ID = ug.USER_ID AND ug.GROUP_ID = ?", name, group_id);
return prepared_statement<bool>("SELECT 1 FROM `" + db_users_table_ + "` u, `" + db_user_group_table_ + "` ug WHERE UPPER(u.username)=UPPER(?) AND u.USER_ID = ug.USER_ID AND ug.GROUP_ID = ?", name, group_id);
} catch (const sql_error& e) {
ERR_UH << "Could not execute test query for user group '" << group_id << "' and username '" << name << "'" << e.message << std::endl;
return false;
Expand Down
2 changes: 1 addition & 1 deletion src/server/forum_user_handler.hpp
Expand Up @@ -105,7 +105,7 @@ class fuh : public user_handler {
std::time_t retrieve_ban_duration_internal(const std::string& col, const std::string& detail);
std::time_t retrieve_ban_duration_internal(const std::string& col, unsigned int detail);

std::string db_name_, db_host_, db_user_, db_password_, db_users_table_, db_banlist_table_, db_extra_table_, db_game_info_table_, db_game_player_info_table_, db_game_modification_info_table_, db_group_table_;
std::string db_name_, db_host_, db_user_, db_password_, db_users_table_, db_banlist_table_, db_extra_table_, db_game_info_table_, db_game_player_info_table_, db_game_modification_info_table_, db_user_group_table_;
unsigned int mp_mod_group_;

MYSQL *conn;
Expand Down

0 comments on commit b2d85bb

Please sign in to comment.