Revision Update (#56)

* Move Mangos revision into GitRevision namespace
This commit is contained in:
Meltie2013 2022-06-29 10:17:06 +01:00 committed by billy1arm
parent 87413b132b
commit f9a203e0da
No known key found for this signature in database
GPG Key ID: 0DF907270598C85F
14 changed files with 137 additions and 86 deletions

View File

@ -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())

View File

@ -51,8 +51,6 @@
#include <cstring> /* std::strcmp */
#include "revision.h"
INSTANTIATE_SINGLETON_1(ScriptMgr);
ScriptMgr::ScriptMgr() : m_scheduledScripts(0), m_lock(0)

View File

@ -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()

View File

@ -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);

@ -1 +1 @@
Subproject commit 6fbc97a45255221c913688281d9d4ca43f74c444
Subproject commit c7b51c226f78088bbe51c129ca41c03728634b45

@ -1 +1 @@
Subproject commit 7d70f55a347aec7ccd2010dcf9e715560e95fad3
Subproject commit 7401c0c72fc0813dae1644abaade216d30ac3a88

View File

@ -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}
)

View File

@ -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;

View File

@ -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();

View File

@ -25,7 +25,7 @@
#include "DatabaseEnv.h"
#include "Config/Config.h"
#include "Database/SqlOperations.h"
#include "revision.h"
#include "GitRevision.h"
#include <ctime>
#include <iostream>
@ -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

View File

@ -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

View File

@ -14,7 +14,7 @@
#define _NO_CVCONST_H
#include <dbghelp.h>
#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;

View File

@ -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 <https://getmangos.eu>
*
* 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__

View File

@ -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