AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
DBUpdaterUtil Class Reference

#include "DBUpdater.h"

Static Public Member Functions

static std::string GetCorrectedMySQLExecutable ()
 
static bool CheckExecutable ()
 
static void MarkUpdateFailed ()
 
static uint32 GetFailedUpdateCount ()
 

Static Private Member Functions

static std::string & corrected_path ()
 
static uint32 & failed_updates ()
 

Detailed Description

Member Function Documentation

◆ CheckExecutable()

bool DBUpdaterUtil::CheckExecutable ( )
static
42{
43 // absolute() without an error_code throws (an empty path, a missing working directory),
44 // and nothing up to main() catches filesystem_error
45 std::error_code ec;
46 std::filesystem::path const configured(GetCorrectedMySQLExecutable());
47 if (!is_regular_file(configured, ec))
48 {
49 std::filesystem::path const found(Acore::SearchExecutableInPath("mysql"));
50 if (!found.empty() && is_regular_file(found, ec))
51 {
52 std::filesystem::path const absoluteFound = absolute(found, ec);
53 if (!ec)
54 {
55 // Correct the path to the cli
56 corrected_path() = absoluteFound.generic_string();
57 return true;
58 }
59 }
60
61 LOG_FATAL("sql.updates", "Didn't find any executable MySQL binary at \'{}\' or in path, correct the path in the *.conf (\"MySQLExecutable\").",
62 configured.generic_string());
63
64 return false;
65 }
66 return true;
67}
#define LOG_FATAL(filterType__,...)
Definition Log.h:141
static std::string & corrected_path()
Definition DBUpdater.cpp:69
static std::string GetCorrectedMySQLExecutable()
Definition DBUpdater.cpp:33
std::string SearchExecutableInPath(std::string const &filename)
Definition StartProcess.cpp:295

References corrected_path(), GetCorrectedMySQLExecutable(), LOG_FATAL, and Acore::SearchExecutableInPath().

◆ corrected_path()

std::string & DBUpdaterUtil::corrected_path ( )
staticprivate
70{
71 static std::string path;
72 return path;
73}

Referenced by CheckExecutable(), and GetCorrectedMySQLExecutable().

◆ failed_updates()

uint32 & DBUpdaterUtil::failed_updates ( )
staticprivate
76{
77 static uint32 count = 0;
78 return count;
79}
std::uint32_t uint32
Definition Define.h:107

Referenced by GetFailedUpdateCount(), and MarkUpdateFailed().

◆ GetCorrectedMySQLExecutable()

std::string DBUpdaterUtil::GetCorrectedMySQLExecutable ( )
static
34{
35 if (!corrected_path().empty())
36 return corrected_path();
37 else
39}
AC_COMMON_API std::string GetMySQLExecutable()
Definition BuiltInConfig.cpp:48

References corrected_path(), and BuiltInConfig::GetMySQLExecutable().

Referenced by CheckExecutable().

◆ GetFailedUpdateCount()

uint32 DBUpdaterUtil::GetFailedUpdateCount ( )
static
87{
88 return failed_updates();
89}
static uint32 & failed_updates()
Definition DBUpdater.cpp:75

References failed_updates().

Referenced by main(), and World::SetInitialWorldSettings().

◆ MarkUpdateFailed()

void DBUpdaterUtil::MarkUpdateFailed ( )
static
82{
84}

References failed_updates().


The documentation for this class was generated from the following files: