From f9a203e0dab2f346e0506a5c00d4a1ab5d73530b Mon Sep 17 00:00:00 2001 From: Meltie2013 Date: Wed, 29 Jun 2022 10:17:06 +0100 Subject: [PATCH] Revision Update (#56) * Move Mangos revision into GitRevision namespace --- src/game/ChatCommands/ServerCommands.cpp | 3 +- src/game/WorldHandlers/ScriptMgr.cpp | 2 - src/game/WorldHandlers/World.cpp | 7 +-- src/mangosd/mangosd.cpp | 5 +- src/modules/Eluna | 2 +- src/realmd | 2 +- src/shared/CMakeLists.txt | 1 - src/shared/Common/GitRevision.cpp | 66 ++++++++++++++++++++++++ src/shared/Common/GitRevision.h | 17 ++++++ src/shared/Database/Database.cpp | 52 +++++++++---------- src/shared/SystemConfig.h.in | 2 - src/shared/Win/WheatyExceptionReport.cpp | 4 +- src/shared/revision.h | 43 --------------- src/shared/revision_data.h.in | 17 ++++++ 14 files changed, 137 insertions(+), 86 deletions(-) delete mode 100644 src/shared/revision.h diff --git a/src/game/ChatCommands/ServerCommands.cpp b/src/game/ChatCommands/ServerCommands.cpp index 0ec3e8b0..9890c919 100644 --- a/src/game/ChatCommands/ServerCommands.cpp +++ b/src/game/ChatCommands/ServerCommands.cpp @@ -29,7 +29,6 @@ #include "GitRevision.h" #include "SystemConfig.h" #include "UpdateTime.h" -#include "revision.h" #include "revision_data.h" /********************************************************************** @@ -47,7 +46,7 @@ bool ChatHandler::HandleServerInfoCommand(char* /*args*/) uint32 updateTime = sWorldUpdateTime.GetLastUpdateTime(); char const* full; - full = REVISION_NR; + full = GitRevision::GetProjectRevision(); SendSysMessage(full); if (sScriptMgr.IsScriptLibraryLoaded()) diff --git a/src/game/WorldHandlers/ScriptMgr.cpp b/src/game/WorldHandlers/ScriptMgr.cpp index d0e0f6b5..60179d4a 100644 --- a/src/game/WorldHandlers/ScriptMgr.cpp +++ b/src/game/WorldHandlers/ScriptMgr.cpp @@ -51,8 +51,6 @@ #include /* std::strcmp */ -#include "revision.h" - INSTANTIATE_SINGLETON_1(ScriptMgr); ScriptMgr::ScriptMgr() : m_scheduledScripts(0), m_lock(0) diff --git a/src/game/WorldHandlers/World.cpp b/src/game/WorldHandlers/World.cpp index 3d93cf22..51182733 100644 --- a/src/game/WorldHandlers/World.cpp +++ b/src/game/WorldHandlers/World.cpp @@ -73,7 +73,7 @@ #include "DisableMgr.h" #include "Language.h" #include "CommandMgr.h" -#include "revision.h" +#include "GitRevision.h" #include "UpdateTime.h" #include "GameTime.h" @@ -1586,14 +1586,15 @@ void World::showFooter() "_______________________________________________________\n" "\n" " Server Version : %s\n" - " Database Version : Rel%i.%i.%i\n" + " Database Version : Rel%s.%s.%s\n" "\n" " Supporting Clients : %s\n" " Builds : %s\n" "\n" " Module Status -\n%s\n" "_______________________________________________________\n" - , REVISION_NR, WORLD_DB_VERSION_NR, WORLD_DB_STRUCTURE_NR, WORLD_DB_CONTENT_NR, thisClientVersion.c_str(), thisClientBuilds.c_str(), sModules.c_str()); + , GitRevision::GetProductVersionStr(), GitRevision::GetWorldDBVersion(), GitRevision::GetWorldDBStructure(), GitRevision::GetWorldDBContent(), + thisClientVersion.c_str(), thisClientBuilds.c_str(), sModules.c_str()); } void World::DetectDBCLang() diff --git a/src/mangosd/mangosd.cpp b/src/mangosd/mangosd.cpp index 974465de..c5b861b0 100644 --- a/src/mangosd/mangosd.cpp +++ b/src/mangosd/mangosd.cpp @@ -39,7 +39,6 @@ #include "Log.h" #include "SystemConfig.h" #include "AuctionHouseBot.h" -#include "revision.h" #include "revision_data.h" #include "World.h" #include "Util.h" @@ -300,7 +299,7 @@ int main(int argc, char** argv) cfg_file = cmd_opts.opt_arg(); break; case 'v': - printf("%s\n", REVISION_NR); + printf("%s\n", GitRevision::GetProjectRevision()); return 0; case 's': { @@ -386,7 +385,7 @@ int main(int argc, char** argv) } #endif - sLog.outString("%s [world-daemon]", REVISION_NR); + sLog.outString("%s [world-daemon]", GitRevision::GetProjectRevision()); sLog.outString("%s", GitRevision::GetFullRevision()); print_banner(); sLog.outString("Using configuration file %s.", cfg_file); diff --git a/src/modules/Eluna b/src/modules/Eluna index 6fbc97a4..c7b51c22 160000 --- a/src/modules/Eluna +++ b/src/modules/Eluna @@ -1 +1 @@ -Subproject commit 6fbc97a45255221c913688281d9d4ca43f74c444 +Subproject commit c7b51c226f78088bbe51c129ca41c03728634b45 diff --git a/src/realmd b/src/realmd index 7d70f55a..7401c0c7 160000 --- a/src/realmd +++ b/src/realmd @@ -1 +1 @@ -Subproject commit 7d70f55a347aec7ccd2010dcf9e715560e95fad3 +Subproject commit 7401c0c72fc0813dae1644abaade216d30ac3a88 diff --git a/src/shared/CMakeLists.txt b/src/shared/CMakeLists.txt index b9f9dd21..9aca63ee 100644 --- a/src/shared/CMakeLists.txt +++ b/src/shared/CMakeLists.txt @@ -208,7 +208,6 @@ add_library(shared STATIC ${SRC_GRP_POLICIES} ${SRC_GRP_SVC} ${SRC_GRP_UTILITIES} - revision.h ${CMAKE_CURRENT_BINARY_DIR/revision_data.h} ${CMAKE_CURRENT_BINARY_DIR/SystemConfig.h} ) diff --git a/src/shared/Common/GitRevision.cpp b/src/shared/Common/GitRevision.cpp index f063fbd7..c84d8024 100644 --- a/src/shared/Common/GitRevision.cpp +++ b/src/shared/Common/GitRevision.cpp @@ -66,6 +66,72 @@ char const* GitRevision::GetHostOSVersion() #define MANGOS_PLATFORM_STR "Unknown System" #endif +// Database Revision +char const* GitRevision::GetProjectRevision() +{ + return PROJECT_REVISION_NR; +} + +char const* GitRevision::GetRealmDBVersion() +{ + return REALMD_DB_VERSION_NR; +} + +char const* GitRevision::GetRealmDBStructure() +{ + return REALMD_DB_STRUCTURE_NR; +} + +char const* GitRevision::GetRealmDBContent() +{ + return REALMD_DB_CONTENT_NR; +} + +char const* GitRevision::GetRealmDBUpdateDescription() +{ + return REALMD_DB_UPDATE_DESCRIPT; +} + +char const* GitRevision::GetCharDBVersion() +{ + return CHAR_DB_VERSION_NR; +} + +char const* GitRevision::GetCharDBStructure() +{ + return CHAR_DB_STRUCTURE_NR; +} + +char const* GitRevision::GetCharDBContent() +{ + return CHAR_DB_CONTENT_NR; +} + +char const* GitRevision::GetCharDBUpdateDescription() +{ + return CHAR_DB_UPDATE_DESCRIPT; +} + +char const* GitRevision::GetWorldDBVersion() +{ + return WORLD_DB_VERSION_NR; +} + +char const* GitRevision::GetWorldDBStructure() +{ + return WORLD_DB_STRUCTURE_NR; +} + +char const* GitRevision::GetWorldDBContent() +{ + return WORLD_DB_CONTENT_NR; +} + +char const* GitRevision::GetWorldDBUpdateDescription() +{ + return WORLD_DB_UPDATE_DESCRIPT; +} + char const* GitRevision::GetFullRevision() { return "Mangos revision: " VER_PRODUCTVERSION_STR; diff --git a/src/shared/Common/GitRevision.h b/src/shared/Common/GitRevision.h index 711aa78e..cde0e67b 100644 --- a/src/shared/Common/GitRevision.h +++ b/src/shared/Common/GitRevision.h @@ -41,6 +41,23 @@ namespace GitRevision char const* GetHostOSVersion(); char const* GetRunningSystem(); + // database data + char const* GetProjectRevision(); + char const* GetRealmDBVersion(); + char const* GetRealmDBStructure(); + char const* GetRealmDBContent(); + char const* GetRealmDBUpdateDescription(); + + char const* GetCharDBVersion(); + char const* GetCharDBStructure(); + char const* GetCharDBContent(); + char const* GetCharDBUpdateDescription(); + + char const* GetWorldDBVersion(); + char const* GetWorldDBStructure(); + char const* GetWorldDBContent(); + char const* GetWorldDBUpdateDescription(); + // application data char const* GetFullRevision(); char const* GetCompanyNameStr(); diff --git a/src/shared/Database/Database.cpp b/src/shared/Database/Database.cpp index 09a4bace..df00c81a 100644 --- a/src/shared/Database/Database.cpp +++ b/src/shared/Database/Database.cpp @@ -25,7 +25,7 @@ #include "DatabaseEnv.h" #include "Config/Config.h" #include "Database/SqlOperations.h" -#include "revision.h" +#include "GitRevision.h" #include #include @@ -38,16 +38,16 @@ struct DBVersion { std::string dbname; - uint32 expected_version; - uint32 expected_structure; - uint32 minimal_expected_content; // Minimal because core can starts with some missing contents + std::string expected_version; + std::string expected_structure; + std::string minimal_expected_content; // Minimal because core can starts with some missing contents std::string description; }; const DBVersion databaseVersions[COUNT_DATABASES] = { - { "World", WORLD_DB_VERSION_NR, WORLD_DB_STRUCTURE_NR, WORLD_DB_CONTENT_NR, WORLD_DB_UPDATE_DESCRIPTION }, // DATABASE_WORLD - { "Realmd", REALMD_DB_VERSION_NR, REALMD_DB_STRUCTURE_NR, REALMD_DB_CONTENT_NR, REALMD_DB_UPDATE_DESCRIPTION }, // DATABASE_REALMD - { "Character", CHAR_DB_VERSION_NR, CHAR_DB_STRUCTURE_NR, CHAR_DB_CONTENT_NR, CHAR_DB_UPDATE_DESCRIPTION }, // DATABASE_CHARACTER + { "World", GitRevision::GetWorldDBVersion(), GitRevision::GetWorldDBStructure(), GitRevision::GetWorldDBContent(), GitRevision::GetWorldDBUpdateDescription() }, // DATABASE_WORLD + { "Realmd", GitRevision::GetRealmDBVersion(), GitRevision::GetRealmDBStructure(), GitRevision::GetRealmDBContent(), GitRevision::GetRealmDBUpdateDescription() }, // DATABASE_REALMD + { "Character", GitRevision::GetCharDBVersion(), GitRevision::GetCharDBStructure(), GitRevision::GetCharDBContent(), GitRevision::GetCharDBUpdateDescription() }, // DATABASE_CHARACTER }; ////////////////////////////////////////////////////////////////////////// @@ -534,35 +534,35 @@ bool Database::RollbackTransaction() return true; } -void PrintNormalYouHaveDatabaseVersion(uint32 current_db_version, uint32 current_db_structure, uint32 current_db_content, std::string description) +void PrintNormalYouHaveDatabaseVersion(std::string current_db_version, std::string current_db_structure, std::string current_db_content, std::string description) { - sLog.outString(" [A] You have database Version: %u", current_db_version); - sLog.outString(" Structure: %u", current_db_structure); - sLog.outString(" Content: %u", current_db_content); + sLog.outString(" [A] You have database Version: %s", current_db_version.c_str()); + sLog.outString(" Structure: %s", current_db_structure.c_str()); + sLog.outString(" Content: %s", current_db_content.c_str()); sLog.outString(" Description: %s", description.c_str()); } -void PrintErrorYouHaveDatabaseVersion(uint32 current_db_version, uint32 current_db_structure, uint32 current_db_content, std::string description) +void PrintErrorYouHaveDatabaseVersion(std::string current_db_version, std::string current_db_structure, std::string current_db_content, std::string description) { - sLog.outErrorDb(" [A] You have database Version: %u", current_db_version); - sLog.outErrorDb(" Structure: %u", current_db_structure); - sLog.outErrorDb(" Content: %u", current_db_content); + sLog.outErrorDb(" [A] You have database Version: %s", current_db_version.c_str()); + sLog.outErrorDb(" Structure: %s", current_db_structure.c_str()); + sLog.outErrorDb(" Content: %s", current_db_content.c_str()); sLog.outErrorDb(" Description: %s", description.c_str()); } void PrintNormalDatabaseVersionReferencedByCore(const DBVersion& core_db_requirements) { - sLog.outString(" [B] The core references last database Version: %u", core_db_requirements.expected_version); - sLog.outString(" Structure: %u", core_db_requirements.expected_structure); - sLog.outString(" Content: %u", core_db_requirements.minimal_expected_content); + sLog.outString(" [B] The core references last database Version: %s", core_db_requirements.expected_version.c_str()); + sLog.outString(" Structure: %s", core_db_requirements.expected_structure.c_str()); + sLog.outString(" Content: %s", core_db_requirements.minimal_expected_content.c_str()); sLog.outString(" Description: %s", core_db_requirements.description.c_str()); } void PrintErrorYouNeedDatabaseVersionExpectedByCore(const DBVersion& core_db_requirements) { - sLog.outErrorDb(" [B] The core needs database Version: %u", core_db_requirements.expected_version); - sLog.outErrorDb(" Structure: %u", core_db_requirements.expected_structure); - sLog.outErrorDb(" Content: %u", core_db_requirements.minimal_expected_content); + sLog.outErrorDb(" [B] The core needs database Version: %s", core_db_requirements.expected_version.c_str()); + sLog.outErrorDb(" Structure: %s", core_db_requirements.expected_structure.c_str()); + sLog.outErrorDb(" Content: %s", core_db_requirements.minimal_expected_content.c_str()); sLog.outErrorDb(" Description: %s", core_db_requirements.description.c_str()); } @@ -589,9 +589,9 @@ bool Database::CheckDatabaseVersion(DatabaseTypes database) } Field* fields = result->Fetch(); - uint32 current_db_version = fields[0].GetUInt32(); - uint32 current_db_structure = fields[1].GetUInt32(); - uint32 current_db_content = fields[2].GetUInt32(); + std::string current_db_version = fields[0].GetCppString(); + std::string current_db_structure = fields[1].GetCppString(); + std::string current_db_content = fields[2].GetCppString(); std::string description = fields[3].GetCppString(); delete result; @@ -623,7 +623,7 @@ bool Database::CheckDatabaseVersion(DatabaseTypes database) { // TODO : Should not display with error color but warning (e.g YELLOW) => Create a sLog.outWarningDb() and sLog.outWarning() sLog.outErrorDb("You have not updated the core for few DB [%s] updates!", core_db_requirements.dbname.c_str()); - sLog.outErrorDb("Current DB content is %u, core expects %u", current_db_content, core_db_requirements.minimal_expected_content); + sLog.outErrorDb("Current DB content is %s, core expects %s", current_db_content.c_str(), core_db_requirements.minimal_expected_content.c_str()); sLog.outErrorDb("It is recommended to run ALL database updates up to the required core version."); sLog.outErrorDb("These updates are included in the database/%s/Updates folder.", core_db_requirements.dbname.c_str()); sLog.outErrorDb("This is ok for now but should not last long."); @@ -646,7 +646,7 @@ bool Database::CheckDatabaseVersion(DatabaseTypes database) { if (current_db_version == core_db_requirements.expected_version && current_db_structure == core_db_requirements.expected_structure) { - sLog.outString("The table `db_version` indicates that your [%s] database hase the same version as the core requirements.", core_db_requirements.dbname.c_str()); + sLog.outString("The table `db_version` indicates that your [%s] database has the same version as the core requirements.", core_db_requirements.dbname.c_str()); sLog.outString(); } else diff --git a/src/shared/SystemConfig.h.in b/src/shared/SystemConfig.h.in index d635f022..63e0e0b4 100644 --- a/src/shared/SystemConfig.h.in +++ b/src/shared/SystemConfig.h.in @@ -57,7 +57,6 @@ #define SYSCONFDIR "@CONF_INSTALL_DIR@/" - #define REALMD_CONFIG_NAME "realmd.conf" #define MANGOSD_CONFIG_NAME "mangosd.conf" #define AUCTIONHOUSEBOT_CONFIG_NAME "ahbot.conf" @@ -66,7 +65,6 @@ #define REALMD_CONFIG_LOCATION SYSCONFDIR REALMD_CONFIG_NAME #define AUCTIONHOUSEBOT_CONFIG_LOCATION SYSCONFDIR AUCTIONHOUSEBOT_CONFIG_NAME - #define DEFAULT_PLAYER_LIMIT 100 #define DEFAULT_WORLDSERVER_PORT 8085 //8129 #define DEFAULT_REALMSERVER_PORT 3724 diff --git a/src/shared/Win/WheatyExceptionReport.cpp b/src/shared/Win/WheatyExceptionReport.cpp index 216f5702..d06653f1 100644 --- a/src/shared/Win/WheatyExceptionReport.cpp +++ b/src/shared/Win/WheatyExceptionReport.cpp @@ -14,7 +14,7 @@ #define _NO_CVCONST_H #include #include "WheatyExceptionReport.h" -#include "revision.h" +#include "GitRevision.h" #define CrashFolder _T("Crashes") //#pragma comment(linker, "/defaultlib:dbghelp.lib") @@ -336,7 +336,7 @@ void WheatyExceptionReport::GenerateExceptionReport( GetLocalTime(&systime); // Start out with a banner - _tprintf(_T("Revision: %s\r\n"), REVISION_NR); + _tprintf(_T("Revision: %s\r\n"), GitRevision::GetProjectRevision()); _tprintf(_T("Date %u:%u:%u. Time %u:%u \r\n"), systime.wDay, systime.wMonth, systime.wYear, systime.wHour, systime.wMinute); PEXCEPTION_RECORD pExceptionRecord = pExceptionInfo->ExceptionRecord; diff --git a/src/shared/revision.h b/src/shared/revision.h deleted file mode 100644 index 17380e01..00000000 --- a/src/shared/revision.h +++ /dev/null @@ -1,43 +0,0 @@ -/** - * MaNGOS is a full featured server for World of Warcraft, supporting - * the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8 - * - * Copyright (C) 2005-2022 MaNGOS - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * World of Warcraft, and all World of Warcraft or Warcraft art, images, - * and lore are copyrighted by Blizzard Entertainment, Inc. - */ - -#ifndef MANGOS_H_REVISION -#define MANGOS_H_REVISION - #define REVISION_NR "2201075" - - #define REALMD_DB_VERSION_NR 22 - #define REALMD_DB_STRUCTURE_NR 1 - #define REALMD_DB_CONTENT_NR 001 - #define REALMD_DB_UPDATE_DESCRIPTION "Release 22" - - #define CHAR_DB_VERSION_NR 22 - #define CHAR_DB_STRUCTURE_NR 2 - #define CHAR_DB_CONTENT_NR 001 - #define CHAR_DB_UPDATE_DESCRIPTION "add_character_createdDate_col" - - #define WORLD_DB_VERSION_NR 22 - #define WORLD_DB_STRUCTURE_NR 4 - #define WORLD_DB_CONTENT_NR 002 - #define WORLD_DB_UPDATE_DESCRIPTION "Update_conditions_comments" -#endif // __REVISION_H__ diff --git a/src/shared/revision_data.h.in b/src/shared/revision_data.h.in index 027cb7b4..d839d049 100644 --- a/src/shared/revision_data.h.in +++ b/src/shared/revision_data.h.in @@ -31,6 +31,23 @@ #define CMAKE_VERSION R"(@CMAKE_VERSION@)" #define CMAKE_HOST_SYSTEM R"(@CMAKE_HOST_SYSTEM_NAME@ @CMAKE_HOST_SYSTEM_VERSION@)" + #define PROJECT_REVISION_NR "2201075" + + #define REALMD_DB_VERSION_NR "22" + #define REALMD_DB_STRUCTURE_NR "01" + #define REALMD_DB_CONTENT_NR "001" + #define REALMD_DB_UPDATE_DESCRIPT "Release 22" + + #define CHAR_DB_VERSION_NR "22" + #define CHAR_DB_STRUCTURE_NR "02" + #define CHAR_DB_CONTENT_NR "001" + #define CHAR_DB_UPDATE_DESCRIPT "add_character_createdDate_col" + + #define WORLD_DB_VERSION_NR "22" + #define WORLD_DB_STRUCTURE_NR "04" + #define WORLD_DB_CONTENT_NR "002" + #define WORLD_DB_UPDATE_DESCRIPT "Update_conditions_comments" + #define VER_COMPANY_NAME_STR "MaNGOS Developers" #define VER_LEGALCOPYRIGHT_STR "(c)2005-@rev_year@ MaNGOS" #define VER_FILEVERSION 0,0,0