mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-15 08:16:08 +00:00
feat(Core/DBUpdater): implement db auto update (#6576)
* feat(Core/DBUpdater): implement db auto update * 1 * 2 * 3 * Some minor improvements * add find bin for mysql 8.0 * lic Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com>
This commit is contained in:
40
src/common/Configuration/BuiltInConfig.cpp
Normal file
40
src/common/Configuration/BuiltInConfig.cpp
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
|
||||
* Copyright (C) 2021+ WarheadCore <https://github.com/WarheadCore>
|
||||
*/
|
||||
|
||||
#include "BuiltInConfig.h"
|
||||
#include "Config.h"
|
||||
#include "GitRevision.h"
|
||||
|
||||
template<typename Fn>
|
||||
static std::string GetStringWithDefaultValueFromFunction(
|
||||
std::string const& key, Fn getter)
|
||||
{
|
||||
std::string const value = sConfigMgr->GetOption<std::string>(key, "");
|
||||
return value.empty() ? getter() : value;
|
||||
}
|
||||
|
||||
std::string BuiltInConfig::GetCMakeCommand()
|
||||
{
|
||||
return GetStringWithDefaultValueFromFunction(
|
||||
"CMakeCommand", GitRevision::GetCMakeCommand);
|
||||
}
|
||||
|
||||
std::string BuiltInConfig::GetBuildDirectory()
|
||||
{
|
||||
return GetStringWithDefaultValueFromFunction(
|
||||
"BuildDirectory", GitRevision::GetBuildDirectory);
|
||||
}
|
||||
|
||||
std::string BuiltInConfig::GetSourceDirectory()
|
||||
{
|
||||
return GetStringWithDefaultValueFromFunction(
|
||||
"SourceDirectory", GitRevision::GetSourceDirectory);
|
||||
}
|
||||
|
||||
std::string BuiltInConfig::GetMySQLExecutable()
|
||||
{
|
||||
return GetStringWithDefaultValueFromFunction(
|
||||
"MySQLExecutable", GitRevision::GetMySQLExecutable);
|
||||
}
|
||||
34
src/common/Configuration/BuiltInConfig.h
Normal file
34
src/common/Configuration/BuiltInConfig.h
Normal file
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license: https://github.com/azerothcore/azerothcore-wotlk/blob/master/LICENSE-AGPL3
|
||||
* Copyright (C) 2021+ WarheadCore <https://github.com/WarheadCore>
|
||||
*/
|
||||
|
||||
#ifndef BUILT_IN_CONFIG_H
|
||||
#define BUILT_IN_CONFIG_H
|
||||
|
||||
#include "Define.h"
|
||||
#include <string>
|
||||
|
||||
/// Provides helper functions to access built-in values
|
||||
/// which can be overwritten in config
|
||||
namespace BuiltInConfig
|
||||
{
|
||||
/// Returns the CMake command when any is specified in the config,
|
||||
/// returns the built-in path otherwise
|
||||
AC_COMMON_API std::string GetCMakeCommand();
|
||||
|
||||
/// Returns the build directory path when any is specified in the config,
|
||||
/// returns the built-in one otherwise
|
||||
AC_COMMON_API std::string GetBuildDirectory();
|
||||
|
||||
/// Returns the source directory path when any is specified in the config,
|
||||
/// returns the built-in one otherwise
|
||||
AC_COMMON_API std::string GetSourceDirectory();
|
||||
|
||||
/// Returns the path to the mysql executable (`mysql`) when any is specified
|
||||
/// in the config, returns the built-in one otherwise
|
||||
AC_COMMON_API std::string GetMySQLExecutable();
|
||||
|
||||
} // namespace BuiltInConfig
|
||||
|
||||
#endif // BUILT_IN_CONFIG_H
|
||||
Reference in New Issue
Block a user