fix(Core/DB): Improve module directory matching for DB updates (#25372)
This commit is contained in:
parent
c51450f52f
commit
b99426b631
2 changed files with 25 additions and 10 deletions
|
|
@ -93,7 +93,8 @@ bool DBUpdater<LoginDatabaseConnection>::IsEnabled(uint32 const updateMask)
|
|||
template<>
|
||||
std::string DBUpdater<LoginDatabaseConnection>::GetDBModuleName()
|
||||
{
|
||||
return "db-auth";
|
||||
// must be lowercase
|
||||
return "auth";
|
||||
}
|
||||
|
||||
// World Database
|
||||
|
|
@ -125,7 +126,8 @@ bool DBUpdater<WorldDatabaseConnection>::IsEnabled(uint32 const updateMask)
|
|||
template<>
|
||||
std::string DBUpdater<WorldDatabaseConnection>::GetDBModuleName()
|
||||
{
|
||||
return "db-world";
|
||||
// must be lowercase
|
||||
return "world";
|
||||
}
|
||||
|
||||
// Character Database
|
||||
|
|
@ -157,7 +159,8 @@ bool DBUpdater<CharacterDatabaseConnection>::IsEnabled(uint32 const updateMask)
|
|||
template<>
|
||||
std::string DBUpdater<CharacterDatabaseConnection>::GetDBModuleName()
|
||||
{
|
||||
return "db-characters";
|
||||
// must be lowercase
|
||||
return "characters";
|
||||
}
|
||||
|
||||
// All
|
||||
|
|
|
|||
|
|
@ -160,18 +160,30 @@ UpdateFetcher::DirectoryStorage UpdateFetcher::ReceiveIncludedDirectories() cons
|
|||
moduleList.emplace_back(itr);
|
||||
|
||||
// data/sql
|
||||
for (auto const& itr : moduleList)
|
||||
for (auto const& moduleName : moduleList)
|
||||
{
|
||||
std::string path = _sourceDirectory->generic_string() + "/modules/" + itr + "/data/sql/" + _dbModuleName; // modules/mod-name/data/sql/db-world
|
||||
|
||||
Path const p(path);
|
||||
std::string path = _sourceDirectory->generic_string() + "/modules/" + moduleName + "/data/sql/"; // modules/mod-name/data/sql/
|
||||
Path const p{path};
|
||||
if (!is_directory(p))
|
||||
continue;
|
||||
|
||||
DirectoryEntry const entry = { p, AppliedFileEntry::StateConvert("MODULE") };
|
||||
directories.push_back(entry);
|
||||
directory_iterator const end;
|
||||
for (directory_iterator itr{p}; itr != end; ++itr)
|
||||
{
|
||||
if (!is_directory(itr->path()))
|
||||
continue;
|
||||
|
||||
LOG_TRACE("sql.updates", "Added applied modules file \"{}\" from remote.", p.filename().generic_string());
|
||||
std::filesystem::path dirPath = itr->path(); // modules/mod-name/data/sql/db-world
|
||||
std::string dirName = dirPath.filename().string(); // db-world
|
||||
|
||||
if (dirName.find(_dbModuleName) == std::string::npos)
|
||||
continue;
|
||||
|
||||
DirectoryEntry const entry = { dirPath, AppliedFileEntry::StateConvert("MODULE") };
|
||||
directories.push_back(entry);
|
||||
|
||||
LOG_TRACE("sql.updates", "Added applied modules file \"{}\" from remote.", dirPath.filename().generic_string());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue