Permalink
Browse files

Copy the entire folder.

TODO: apply basic files for logon and characters if they not exist.
  • Loading branch information...
Zyres committed Jul 29, 2018
1 parent 7139239 commit ab2ec71925528f0645fdc925e1ba8370abb433b1
Showing with 19 additions and 14 deletions.
  1. +1 −3 CMakeLists.txt
  2. +3 −6 cmake/Systems/Windows.cmake
  3. +11 −4 src/logonserver/Server/Master.cpp
  4. +4 −1 src/world/Server/Master.cpp
View
@@ -40,8 +40,6 @@ add_subdirectory(src/scripts)
if(WIN32)
install(FILES ${INSTALLED_DEPENDENCIES} DESTINATION .)
if(WITH_EXPERIMENTAL_FILESYSTEM)
install(DIRECTORY ${INSTALL_LOGON_UPDATES} DESTINATION sql/logon FILES_MATCHING PATTERN "*.sql")
install(DIRECTORY ${INSTALL_CHARACTER_UPDATES} DESTINATION sql/character FILES_MATCHING PATTERN "*.sql")
install(DIRECTORY ${INSTALL_WORLD_UPDATES} DESTINATION sql/world FILES_MATCHING PATTERN "*.sql")
install(DIRECTORY ${INSTALL_DB_FILES} DESTINATION sql FILES_MATCHING PATTERN "*.sql")
endif()
endif()
@@ -52,13 +52,10 @@ set(INSTALLED_DEPENDENCIES
)
#check for db update files
set(PATH_DB_LOGON_UPDATES ${CMAKE_SOURCE_DIR}/sql/logon/updates/)
set(PATH_DB_CHARACTER_UPDATES ${CMAKE_SOURCE_DIR}/sql/character/updates/)
set(PATH_DB_WORLD_UPDATES ${CMAKE_SOURCE_DIR}/sql/world/updates/)
set(PATH_DB_FILES ${CMAKE_SOURCE_DIR}/sql/)
set(INSTALL_DB_FILES ${PATH_DB_FILES})
set(INSTALL_LOGON_UPDATES ${PATH_DB_LOGON_UPDATES})
set(INSTALL_CHARACTER_UPDATES ${PATH_DB_CHARACTER_UPDATES})
set(INSTALL_WORLD_UPDATES ${PATH_DB_WORLD_UPDATES})
if(MSVC)
include(${CMAKE_SOURCE_DIR}/cmake/Compilers/msvc.cmake)
@@ -33,7 +33,7 @@ std::set<AuthSocket*> _authSockets;
ConfigMgr Config;
// DB version
// MIT start
static const char* REQUIRED_LOGON_DB_VERSION = "20180729-00_logon_db_version";
#ifdef USE_EXPERIMENTAL_FILESYSTEM
@@ -51,7 +51,7 @@ struct DatabaseUpdateFile
void applyUpdatesForDatabase(std::string database)
{
const std::string sqlUpdateDir = "sql/" + database;
const std::string sqlUpdateDir = "sql/" + database + "/updates";
//////////////////////////////////////////////////////////////////////////////////////////
// 1. get current version
@@ -94,6 +94,9 @@ void applyUpdatesForDatabase(std::string database)
dbUpdateFile.majorVersion = majorVersion;
dbUpdateFile.minorVersion = minorVersion;
//\todo Remove me
LogDetail("Available file in updates dir: %s", filePathName.c_str());
updateSqlStore.insert(std::pair<uint32_t, DatabaseUpdateFile>(count, dbUpdateFile));
++count;
}
@@ -104,7 +107,7 @@ void applyUpdatesForDatabase(std::string database)
if (!updateSqlStore.empty())
{
LogDebugFlag(LF_DB_TABLES, "=========== New %s update files in %s ===========", database.c_str(), sqlUpdateDir.c_str());
LogDebug("=========== New %s update files in %s ===========", database.c_str(), sqlUpdateDir.c_str());
//compare it with latest update in mysql
for (const auto update : updateSqlStore)
{
@@ -118,7 +121,7 @@ void applyUpdatesForDatabase(std::string database)
if (addToUpdateFiles)
{
applyNewUpdateFilesStore.insert(update);
LogDebugFlag(LF_DB_TABLES, "Updatefile %s, Major(%u), Minor(%u) - added and ready to be applied!", update.second.fullName.c_str(), update.second.majorVersion, update.second.minorVersion);
LogDebug("Updatefile %s, Major(%u), Minor(%u) - added and ready to be applied!", update.second.fullName.c_str(), update.second.majorVersion, update.second.minorVersion);
}
}
}
@@ -162,6 +165,8 @@ void applyUpdatesForDatabase(std::string database)
}
#endif
// MIT end
void LogonServer::Run(int /*argc*/, char** /*argv*/)
{
UNIXTIME = time(NULL);
@@ -191,6 +196,8 @@ void LogonServer::Run(int /*argc*/, char** /*argv*/)
return;
}
//\todo if database is empty, apply basic files
#ifdef USE_EXPERIMENTAL_FILESYSTEM
applyUpdatesForDatabase("logon");
#endif
@@ -171,7 +171,7 @@ bool checkRequiredDirs()
void applyUpdatesForDatabase(std::string database)
{
const std::string sqlUpdateDir = "sql/" + database;
const std::string sqlUpdateDir = "sql/" + database + "/updates";
//////////////////////////////////////////////////////////////////////////////////////////
// 1. get current version
@@ -216,6 +216,9 @@ void applyUpdatesForDatabase(std::string database)
dbUpdateFile.majorVersion = majorVersion;
dbUpdateFile.minorVersion = minorVersion;
//\todo Remove me
LogDetail("Available file in updates dir: %s", filePathName.c_str());
updateSqlStore.insert(std::pair<uint32_t, DatabaseUpdateFile>(count, dbUpdateFile));
++count;
}

0 comments on commit ab2ec71

Please sign in to comment.