mirror of
https://github.com/EQEmu/Server.git
synced 2026-04-14 20:12:26 +00:00
Port import and eport client files to use content database connection [skip ci]
This commit is contained in:
parent
ea98a71f22
commit
a37260fec5
@ -49,6 +49,8 @@ int main(int argc, char **argv)
|
|||||||
auto Config = EQEmuConfig::get();
|
auto Config = EQEmuConfig::get();
|
||||||
|
|
||||||
SharedDatabase database;
|
SharedDatabase database;
|
||||||
|
SharedDatabase content_db;
|
||||||
|
|
||||||
LogInfo("Connecting to database");
|
LogInfo("Connecting to database");
|
||||||
if (!database.Connect(
|
if (!database.Connect(
|
||||||
Config->DatabaseHost.c_str(),
|
Config->DatabaseHost.c_str(),
|
||||||
@ -61,7 +63,24 @@ int main(int argc, char **argv)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Register Log System and Settings */
|
/**
|
||||||
|
* Multi-tenancy: Content database
|
||||||
|
*/
|
||||||
|
if (!Config->ContentDbHost.empty()) {
|
||||||
|
if (!content_db.Connect(
|
||||||
|
Config->ContentDbHost.c_str() ,
|
||||||
|
Config->ContentDbUsername.c_str(),
|
||||||
|
Config->ContentDbPassword.c_str(),
|
||||||
|
Config->ContentDbName.c_str(),
|
||||||
|
Config->ContentDbPort
|
||||||
|
)) {
|
||||||
|
LogError("Cannot continue without a content database connection");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
content_db.SetMysql(database.getMySQL());
|
||||||
|
}
|
||||||
|
|
||||||
database.LoadLogSettings(LogSys.log_settings);
|
database.LoadLogSettings(LogSys.log_settings);
|
||||||
LogSys.StartFileLogs();
|
LogSys.StartFileLogs();
|
||||||
|
|
||||||
@ -72,15 +91,15 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (arg_1 == "spells") {
|
if (arg_1 == "spells") {
|
||||||
ExportSpells(&database);
|
ExportSpells(&content_db);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (arg_1 == "skills") {
|
if (arg_1 == "skills") {
|
||||||
ExportSkillCaps(&database);
|
ExportSkillCaps(&content_db);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (arg_1 == "basedata") {
|
if (arg_1 == "basedata") {
|
||||||
ExportBaseData(&database);
|
ExportBaseData(&content_db);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (arg_1 == "dbstring") {
|
if (arg_1 == "dbstring") {
|
||||||
@ -88,9 +107,9 @@ int main(int argc, char **argv)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExportSpells(&database);
|
ExportSpells(&content_db);
|
||||||
ExportSkillCaps(&database);
|
ExportSkillCaps(&content_db);
|
||||||
ExportBaseData(&database);
|
ExportBaseData(&content_db);
|
||||||
ExportDBStrings(&database);
|
ExportDBStrings(&database);
|
||||||
|
|
||||||
LogSys.CloseFileLogs();
|
LogSys.CloseFileLogs();
|
||||||
|
|||||||
@ -46,20 +46,44 @@ int main(int argc, char **argv) {
|
|||||||
auto Config = EQEmuConfig::get();
|
auto Config = EQEmuConfig::get();
|
||||||
|
|
||||||
SharedDatabase database;
|
SharedDatabase database;
|
||||||
|
SharedDatabase content_db;
|
||||||
|
|
||||||
LogInfo("Connecting to database");
|
LogInfo("Connecting to database");
|
||||||
if(!database.Connect(Config->DatabaseHost.c_str(), Config->DatabaseUsername.c_str(),
|
if (!database.Connect(
|
||||||
Config->DatabasePassword.c_str(), Config->DatabaseDB.c_str(), Config->DatabasePort)) {
|
Config->DatabaseHost.c_str(),
|
||||||
LogError("Unable to connect to the database, cannot continue without a "
|
Config->DatabaseUsername.c_str(),
|
||||||
"database connection");
|
Config->DatabasePassword.c_str(),
|
||||||
|
Config->DatabaseDB.c_str(),
|
||||||
|
Config->DatabasePort
|
||||||
|
)) {
|
||||||
|
LogError("Unable to connect to the database, cannot continue without a database connection");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Multi-tenancy: Content database
|
||||||
|
*/
|
||||||
|
if (!Config->ContentDbHost.empty()) {
|
||||||
|
if (!content_db.Connect(
|
||||||
|
Config->ContentDbHost.c_str() ,
|
||||||
|
Config->ContentDbUsername.c_str(),
|
||||||
|
Config->ContentDbPassword.c_str(),
|
||||||
|
Config->ContentDbName.c_str(),
|
||||||
|
Config->ContentDbPort
|
||||||
|
)) {
|
||||||
|
LogError("Cannot continue without a content database connection");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
content_db.SetMysql(database.getMySQL());
|
||||||
|
}
|
||||||
|
|
||||||
database.LoadLogSettings(LogSys.log_settings);
|
database.LoadLogSettings(LogSys.log_settings);
|
||||||
LogSys.StartFileLogs();
|
LogSys.StartFileLogs();
|
||||||
|
|
||||||
ImportSpells(&database);
|
ImportSpells(&content_db);
|
||||||
ImportSkillCaps(&database);
|
ImportSkillCaps(&content_db);
|
||||||
ImportBaseData(&database);
|
ImportBaseData(&content_db);
|
||||||
ImportDBStrings(&database);
|
ImportDBStrings(&database);
|
||||||
|
|
||||||
LogSys.CloseFileLogs();
|
LogSys.CloseFileLogs();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user