diff options
| author | Naios <naios-dev@live.de> | 2016-02-21 15:52:42 +0100 |
|---|---|---|
| committer | Naios <naios-dev@live.de> | 2016-02-21 15:52:42 +0100 |
| commit | 719159e2074ac2d0902c70bdd3c7a39e0d311bbe (patch) | |
| tree | 11f772b81ffef8e238cd5f91110fb1edc5f384cc /src/server | |
| parent | 5534915f743c707c07cb977bca67c2ff15487597 (diff) | |
Core/Common: Add a generic config helper to access built-in overwriteable paths.
* Adds CMAKE_COMMAND and CMAKE_BINARY_DIR to revision_data.h
* Move the source and mysql exe path handling out of the DBUpdater.
* Make some Config methods const for correctness.
* Remove C & CXX flags from revision_data.h
(was unused and didn't capture all cxx vars)
* Reorder the link order to prevent `ld` from ignoring the file
* Ref #15671
Diffstat (limited to 'src/server')
| -rw-r--r-- | src/server/bnetserver/CMakeLists.txt | 4 | ||||
| -rw-r--r-- | src/server/bnetserver/bnetserver.conf.dist | 40 | ||||
| -rw-r--r-- | src/server/database/Updater/DBUpdater.cpp | 33 | ||||
| -rw-r--r-- | src/server/database/Updater/DBUpdater.h | 4 | ||||
| -rw-r--r-- | src/server/worldserver/CMakeLists.txt | 4 | ||||
| -rw-r--r-- | src/server/worldserver/worldserver.conf.dist | 59 |
6 files changed, 74 insertions, 70 deletions
diff --git a/src/server/bnetserver/CMakeLists.txt b/src/server/bnetserver/CMakeLists.txt index e3f4defd479..6d19b9ca95e 100644 --- a/src/server/bnetserver/CMakeLists.txt +++ b/src/server/bnetserver/CMakeLists.txt @@ -87,10 +87,10 @@ if( NOT WIN32 ) endif() target_link_libraries(bnetserver - common + shared database ipc - shared + common zmqpp format ${MYSQL_LIBRARY} diff --git a/src/server/bnetserver/bnetserver.conf.dist b/src/server/bnetserver/bnetserver.conf.dist index e90cd4634f7..cf5d27699d8 100644 --- a/src/server/bnetserver/bnetserver.conf.dist +++ b/src/server/bnetserver/bnetserver.conf.dist @@ -138,6 +138,26 @@ WrongPass.BanType = 0 WrongPass.Logging = 0 # +# SourceDirectory +# Description: The path to your TrinityCore source directory. +# If the path is left empty, the built-in CMAKE_SOURCE_DIR is used. +# Example: "../TrinityCore" +# Default: "" + +SourceDirectory = "" + +# +# MySQLExecutable +# Description: The path to your mysql cli binary. +# If the path is left empty, built-in path from cmake is used. +# Example: "C:/Program Files/MySQL/MySQL Server 5.6/bin/mysql.exe" +# "mysql.exe" +# "/usr/bin/mysql" +# Default: "" + +MySQLExecutable = "" + +# ################################################################################################### ################################################################################################### @@ -181,26 +201,6 @@ LoginDatabase.WorkerThreads = 1 Updates.EnableDatabases = 0 # -# Updates.SourcePath -# Description: The path to your TrinityCore source directory. -# If the path is left empty, built-in CMAKE_SOURCE_DIR is used. -# Example: "../TrinityCore" -# Default: "" - -Updates.SourcePath = "" - -# -# Updates.MySqlCLIPath -# Description: The path to your mysql cli binary. -# If the path is left empty, built-in path from cmake is used. -# Example: "C:/Program Files/MySQL/MySQL Server 5.6/bin/mysql.exe" -# "mysql.exe" -# "/usr/bin/mysql" -# Default: "" - -Updates.MySqlCLIPath = "" - -# # Updates.AutoSetup # Description: Auto populate empty databases. # Default: 1 - (Enabled) diff --git a/src/server/database/Updater/DBUpdater.cpp b/src/server/database/Updater/DBUpdater.cpp index b36ccd37691..ab4b767b104 100644 --- a/src/server/database/Updater/DBUpdater.cpp +++ b/src/server/database/Updater/DBUpdater.cpp @@ -21,6 +21,7 @@ #include "UpdateFetcher.h" #include "DatabaseLoader.h" #include "Config.h" +#include "BuiltInConfig.h" #include <fstream> #include <iostream> @@ -35,23 +36,17 @@ using namespace boost::process; using namespace boost::process::initializers; using namespace boost::iostreams; -std::string DBUpdaterUtil::GetMySqlCli() +std::string DBUpdaterUtil::GetCorrectedMySQLExecutable() { if (!corrected_path().empty()) return corrected_path(); else - { - std::string const entry = sConfigMgr->GetStringDefault("Updates.MySqlCLIPath", ""); - if (!entry.empty()) - return entry; - else - return GitRevision::GetMySQLExecutable(); - } + return BuiltInConfig::GetMySQLExecutable(); } bool DBUpdaterUtil::CheckExecutable() { - boost::filesystem::path exe(GetMySqlCli()); + boost::filesystem::path exe(GetCorrectedMySQLExecutable()); if (!exists(exe)) { exe.clear(); @@ -85,16 +80,6 @@ std::string& DBUpdaterUtil::corrected_path() return path; } -template<class T> -std::string DBUpdater<T>::GetSourceDirectory() -{ - std::string const entry = sConfigMgr->GetStringDefault("Updates.SourcePath", ""); - if (!entry.empty()) - return entry; - else - return GitRevision::GetSourceDirectory(); -} - // Auth Database template<> std::string DBUpdater<LoginDatabaseConnection>::GetConfigEntry() @@ -111,7 +96,8 @@ std::string DBUpdater<LoginDatabaseConnection>::GetTableName() template<> std::string DBUpdater<LoginDatabaseConnection>::GetBaseFile() { - return DBUpdater<LoginDatabaseConnection>::GetSourceDirectory() + "/sql/base/auth_database.sql"; + return BuiltInConfig::GetSourceDirectory() + + "/sql/base/auth_database.sql"; } template<> @@ -169,7 +155,8 @@ std::string DBUpdater<CharacterDatabaseConnection>::GetTableName() template<> std::string DBUpdater<CharacterDatabaseConnection>::GetBaseFile() { - return DBUpdater<CharacterDatabaseConnection>::GetSourceDirectory() + "/sql/base/characters_database.sql"; + return BuiltInConfig::GetSourceDirectory() + + "/sql/base/characters_database.sql"; } template<> @@ -271,7 +258,7 @@ bool DBUpdater<T>::Update(DatabaseWorkerPool<T>& pool) TC_LOG_INFO("sql.updates", "Updating %s database...", DBUpdater<T>::GetTableName().c_str()); - Path const sourceDirectory(GetSourceDirectory()); + Path const sourceDirectory(BuiltInConfig::GetSourceDirectory()); if (!is_directory(sourceDirectory)) { @@ -442,7 +429,7 @@ void DBUpdater<T>::ApplyFile(DatabaseWorkerPool<T>& pool, std::string const& hos boost::process::pipe errPipe = create_pipe(); child c = execute(run_exe( - boost::filesystem::absolute(DBUpdaterUtil::GetMySqlCli()).generic_string()), + boost::filesystem::absolute(DBUpdaterUtil::GetCorrectedMySQLExecutable()).generic_string()), set_args(args), bind_stdin(source), throw_on_error(), bind_stdout(file_descriptor_sink(outPipe.sink, close_handle)), bind_stderr(file_descriptor_sink(errPipe.sink, close_handle))); diff --git a/src/server/database/Updater/DBUpdater.h b/src/server/database/Updater/DBUpdater.h index c9792ffe060..dbb897d2527 100644 --- a/src/server/database/Updater/DBUpdater.h +++ b/src/server/database/Updater/DBUpdater.h @@ -57,7 +57,7 @@ struct UpdateResult class DBUpdaterUtil { public: - static std::string GetMySqlCli(); + static std::string GetCorrectedMySQLExecutable(); static bool CheckExecutable(); @@ -71,8 +71,6 @@ class DBUpdater public: using Path = boost::filesystem::path; - static std::string GetSourceDirectory(); - static inline std::string GetConfigEntry(); static inline std::string GetTableName(); diff --git a/src/server/worldserver/CMakeLists.txt b/src/server/worldserver/CMakeLists.txt index 55d64d8c923..0d1a296e68a 100644 --- a/src/server/worldserver/CMakeLists.txt +++ b/src/server/worldserver/CMakeLists.txt @@ -140,11 +140,11 @@ set_target_properties(worldserver PROPERTIES LINK_FLAGS "${worldserver_LINK_FLAG target_link_libraries(worldserver game - common + scripts shared database - scripts ipc + common g3dlib gsoap Detour diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index f2a594e7482..b6787e25e19 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -176,6 +176,45 @@ BindIP = "0.0.0.0" ThreadPool = 2 # +# CMakeCommand +# Description: The path to your CMake binary. +# If the path is left empty, the built-in CMAKE_COMMAND is used. +# Example: "C:/Program Files (x86)/CMake/bin/cmake.exe" +# "/usr/bin/cmake" +# Default: "" + +CMakeCommand = "" + +# +# BuildDirectory +# Description: The path to your build directory. +# If the path is left empty, the built-in CMAKE_BINARY_DIR is used. +# Example: "../TrinityCore" +# Default: "" + +BuildDirectory = "" + +# +# SourceDirectory +# Description: The path to your TrinityCore source directory. +# If the path is left empty, the built-in CMAKE_SOURCE_DIR is used. +# Example: "../TrinityCore" +# Default: "" + +SourceDirectory = "" + +# +# MySQLExecutable +# Description: The path to your mysql cli binary. +# If the path is left empty, built-in path from cmake is used. +# Example: "C:/Program Files/MySQL/MySQL Server 5.6/bin/mysql.exe" +# "mysql.exe" +# "/usr/bin/mysql" +# Default: "" + +MySQLExecutable = "" + +# ################################################################################################### ################################################################################################### @@ -1149,26 +1188,6 @@ FeatureSystem.CharacterUndelete.Cooldown = 2592000 Updates.EnableDatabases = 15 # -# Updates.SourcePath -# Description: The path to your TrinityCore source directory. -# If the path is left empty, built-in CMAKE_SOURCE_DIR is used. -# Example: "../TrinityCore" -# Default: "" - -Updates.SourcePath = "" - -# -# Updates.MySqlCLIPath -# Description: The path to your mysql cli binary. -# If the path is left empty, built-in path from cmake is used. -# Example: "C:/Program Files/MySQL/MySQL Server 5.6/bin/mysql.exe" -# "mysql.exe" -# "/usr/bin/mysql" -# Default: "" - -Updates.MySqlCLIPath = "" - -# # Updates.AutoSetup # Description: Auto populate empty databases. # Default: 1 - (Enabled) |
