Cleanup server running variable information (#2239)

* Created first round of helper functions

Started to go through server init function and move statically defined
variables that the server uses into helper functions to allow for
dynamic changing while the server is up rather than requiring a restart.

* Completed Helper Function Creation

Completed adding all the helper functions along with updated the virtual
server function calls and renamed helper functions to match settings
cached ini value names for clarity.

* Comment Cleanup

Removed lines commented out throughout previous changes as well as
cleaned up variable declarations that are no longer needed with helper
functions that query the settingsCache

* Added featureset dynamic refreshing

Added slots/functions/calls for updating the required feature sets
dynamically.

* Created first round of helper functions

Started to go through server init function and move statically defined
variables that the server uses into helper functions to allow for
dynamic changing while the server is up rather than requiring a restart.
This commit is contained in:
woogerboy21 2016-10-31 05:30:12 -04:00 committed by ctrlaltca
parent 3498b16e01
commit 21a34eaaa1
9 changed files with 279 additions and 170 deletions

View file

@ -568,7 +568,7 @@ void Servatrice_DatabaseInterface::clearSessionTables()
{
lockSessionTables();
QSqlQuery *query = prepareQuery("update {prefix}_sessions set end_time=now() where end_time is null and id_server = :id_server");
query->bindValue(":id_server", server->getServerId());
query->bindValue(":id_server", server->getServerID());
execSqlQuery(query);
unlockSessionTables();
}
@ -590,7 +590,7 @@ bool Servatrice_DatabaseInterface::userSessionExists(const QString &userName)
// Call only after lockSessionTables().
QSqlQuery *query = prepareQuery("select 1 from {prefix}_sessions where user_name = :user_name and id_server = :id_server and end_time is null");
query->bindValue(":id_server", server->getServerId());
query->bindValue(":id_server", server->getServerID());
query->bindValue(":user_name", userName);
execSqlQuery(query);
return query->next();
@ -606,7 +606,7 @@ qint64 Servatrice_DatabaseInterface::startSession(const QString &userName, const
QSqlQuery *query = prepareQuery("insert into {prefix}_sessions (user_name, id_server, ip_address, start_time, clientid, connection_type) values(:user_name, :id_server, :ip_address, NOW(), :client_id, :connection_type)");
query->bindValue(":user_name", userName);
query->bindValue(":id_server", server->getServerId());
query->bindValue(":id_server", server->getServerID());
query->bindValue(":ip_address", address);
query->bindValue(":client_id", clientId);
query->bindValue(":connection_type", connectionType);
@ -880,7 +880,7 @@ int Servatrice_DatabaseInterface::getActiveUserCount(QString connectionType)
text +=" AND connection_type = :connection_type";
QSqlQuery *query = prepareQuery(text);
query->bindValue(":serverid", server->getServerId());
query->bindValue(":serverid", server->getServerID());
if(!connectionType.isEmpty())
query->bindValue(":connection_type", connectionType);