mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-02-01 22:56:39 +01:00
Dep: Switch to boost process instead of old standalone version
This commit is contained in:
@@ -40,10 +40,10 @@ std::string DBUpdaterUtil::GetCorrectedMySQLExecutable()
|
||||
bool DBUpdaterUtil::CheckExecutable()
|
||||
{
|
||||
boost::filesystem::path exe(GetCorrectedMySQLExecutable());
|
||||
if (!exists(exe))
|
||||
if (!is_regular_file(exe))
|
||||
{
|
||||
exe = Trinity::SearchExecutableInPath("mysql");
|
||||
if (!exe.empty() && exists(exe))
|
||||
if (!exe.empty() && is_regular_file(exe))
|
||||
{
|
||||
// Correct the path to the cli
|
||||
corrected_path() = absolute(exe).generic_string();
|
||||
@@ -363,50 +363,47 @@ void DBUpdater<T>::ApplyFile(DatabaseWorkerPool<T>& pool, std::string const& hos
|
||||
std::string const& password, std::string const& port_or_socket, std::string const& database, Path const& path)
|
||||
{
|
||||
std::vector<std::string> args;
|
||||
args.reserve(8);
|
||||
|
||||
// args[0] represents the program name
|
||||
args.push_back("mysql");
|
||||
args.reserve(7);
|
||||
|
||||
// CLI Client connection info
|
||||
args.push_back("-h" + host);
|
||||
args.push_back("-u" + user);
|
||||
args.emplace_back("-h" + host);
|
||||
args.emplace_back("-u" + user);
|
||||
|
||||
if (!password.empty())
|
||||
args.push_back("-p" + password);
|
||||
args.emplace_back("-p" + password);
|
||||
|
||||
// Check if we want to connect through ip or socket (Unix only)
|
||||
#ifdef _WIN32
|
||||
|
||||
if (host == ".")
|
||||
args.push_back("--protocol=PIPE");
|
||||
args.emplace_back("--protocol=PIPE");
|
||||
else
|
||||
args.push_back("-P" + port_or_socket);
|
||||
args.emplace_back("-P" + port_or_socket);
|
||||
|
||||
#else
|
||||
|
||||
if (!std::isdigit(port_or_socket[0]))
|
||||
{
|
||||
// We can't check if host == "." here, because it is named localhost if socket option is enabled
|
||||
args.push_back("-P0");
|
||||
args.push_back("--protocol=SOCKET");
|
||||
args.push_back("-S" + port_or_socket);
|
||||
args.emplace_back("-P0");
|
||||
args.emplace_back("--protocol=SOCKET");
|
||||
args.emplace_back("-S" + port_or_socket);
|
||||
}
|
||||
else
|
||||
// generic case
|
||||
args.push_back("-P" + port_or_socket);
|
||||
args.emplace_back("-P" + port_or_socket);
|
||||
|
||||
#endif
|
||||
|
||||
// Set the default charset to utf8
|
||||
args.push_back("--default-character-set=utf8");
|
||||
args.emplace_back("--default-character-set=utf8");
|
||||
|
||||
// Set max allowed packet to 1 GB
|
||||
args.push_back("--max-allowed-packet=1GB");
|
||||
args.emplace_back("--max-allowed-packet=1GB");
|
||||
|
||||
// Database
|
||||
if (!database.empty())
|
||||
args.push_back(database);
|
||||
args.emplace_back(database);
|
||||
|
||||
// Invokes a mysql process which doesn't leak credentials to logs
|
||||
int const ret = Trinity::StartProcess(DBUpdaterUtil::GetCorrectedMySQLExecutable(), args,
|
||||
|
||||
@@ -275,7 +275,7 @@ Optional<std::shared_ptr<ScriptModule>>
|
||||
path.generic_string().c_str());
|
||||
}
|
||||
|
||||
return boost::none;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
// Use RAII to release the library on failure.
|
||||
@@ -368,7 +368,6 @@ static int InvokeCMakeCommand(T&&... args)
|
||||
{
|
||||
auto const executable = BuiltInConfig::GetCMakeCommand();
|
||||
return Trinity::StartProcess(executable, {
|
||||
executable,
|
||||
std::forward<T>(args)...
|
||||
}, "scripts.hotswap");
|
||||
}
|
||||
@@ -379,7 +378,6 @@ static std::shared_ptr<Trinity::AsyncProcessResult> InvokeAsyncCMakeCommand(T&&.
|
||||
{
|
||||
auto const executable = BuiltInConfig::GetCMakeCommand();
|
||||
return Trinity::StartAsyncProcess(executable, {
|
||||
executable,
|
||||
std::forward<T>(args)...
|
||||
}, "scripts.hotswap");
|
||||
}
|
||||
@@ -1358,7 +1356,7 @@ private:
|
||||
return;
|
||||
|
||||
TC_LOG_INFO("scripts.hotswap", ">> Found outdated CMAKE_INSTALL_PREFIX (\"%s\"), "
|
||||
"worldserver is currently installed at %s...",
|
||||
"worldserver is currently installed at %s",
|
||||
value.generic_string().c_str(), current_path.generic_string().c_str());
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user