Merge branch 'master' into Playerbot

# Conflicts:
#	src/server/game/Guilds/Guild.cpp
This commit is contained in:
郑佩茹
2022-11-18 10:21:36 -07:00
312 changed files with 104564 additions and 1583 deletions

View File

@@ -228,11 +228,13 @@ BaseLocation DBUpdater<T>::GetBaseLocationType()
template<class T>
bool DBUpdater<T>::Create(DatabaseWorkerPool<T>& pool)
{
LOG_WARN("sql.updates", "Database \"{}\" does not exist, do you want to create it? [yes (default) / no]: ",
pool.GetConnectionInfo()->database);
LOG_WARN("sql.updates", "Database \"{}\" does not exist", pool.GetConnectionInfo()->database);
if (!sConfigMgr->isDryRun())
const char* disableInteractive = std::getenv("AC_DISABLE_INTERACTIVE");
if (!sConfigMgr->isDryRun() && (disableInteractive == nullptr || std::strcmp(disableInteractive, "1") != 0))
{
std::cout << "Do you want to create it? [yes (default) / no]:" << std::endl;
std::string answer;
std::getline(std::cin, answer);
if (!answer.empty() && !(answer.substr(0, 1) == "y"))
@@ -498,16 +500,29 @@ template<class T>
void DBUpdater<T>::ApplyFile(DatabaseWorkerPool<T>& pool, std::string const& host, std::string const& user,
std::string const& password, std::string const& port_or_socket, std::string const& database, std::string const& ssl, Path const& path)
{
std::string configTempDir = sConfigMgr->GetOption<std::string>("TempDir", "");
auto tempDir = configTempDir.empty() ? std::filesystem::temp_directory_path().string() : configTempDir;
tempDir = Acore::String::AddSuffixIfNotExists(tempDir, std::filesystem::path::preferred_separator);
std::string confFileName = "mysql_ac.conf";
std::ofstream outfile (tempDir + confFileName);
outfile << "[client]\npassword = \"" << password << '"' << std::endl;
outfile.close();
std::vector<std::string> args;
args.reserve(9);
args.emplace_back("--defaults-extra-file="+tempDir + confFileName+"");
// CLI Client connection info
args.emplace_back("-h" + host);
args.emplace_back("-u" + user);
if (!password.empty())
args.emplace_back("-p" + password);
// Check if we want to connect through ip or socket (Unix only)
#ifdef _WIN32