mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-02 02:43:44 +00:00
chore(dashboard): remove the Maintenance page
The page held one-off repairs from Nexus Dashboard (approve known pet names, find/delete orphaned pet names, remove every buff, fix property clone IDs, list mission rewards without a commendation price). Removed the page, its sidebar entry, its /api/maintenance/* routes, the `maintenance` permission and the two database calls only it used (GetAllPetNames, FixPropertyCloneIds). The scheduled tasks (lift expired bans, fill in pet owners, approve known pet names) and property model import/removal stay. Check: the Admin sidebar group has no Maintenance link; /maintenance is a 404; the Tasks page still lists "Approve known pet names" and "Fill in pet owners"; property import still works; the Permissions page no longer lists "Data maintenance". Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -9,23 +9,17 @@
|
||||
|
||||
#include "dCommonVars.h"
|
||||
|
||||
// Bulk data repairs run from the dashboard's maintenance page
|
||||
// Bulk data reads and repairs for dashboard reports and scheduled tasks
|
||||
class IDashboardMaintenance {
|
||||
public:
|
||||
// Approve pending pet names that an earlier pet with the same name was approved for. Returns rows changed.
|
||||
virtual uint32_t ApprovePreviouslyApprovedPetNames() = 0;
|
||||
|
||||
// Every pet name as (id, name)
|
||||
virtual std::vector<std::pair<LWOOBJID, std::string>> GetAllPetNames() = 0;
|
||||
|
||||
// Call visit for every character's XML, one row at a time
|
||||
virtual void ForEachCharacterXml(const std::function<void(LWOOBJID, const std::string&)>& visit) = 0;
|
||||
|
||||
// Same, but only characters whose XML contains `needle`; the database does the filtering
|
||||
virtual void ForEachCharacterXmlContaining(const std::string& needle, const std::function<void(LWOOBJID, const std::string&)>& visit) = 0;
|
||||
|
||||
// Set each property's clone id to its owner's prop_clone_id where they differ. Returns rows changed.
|
||||
virtual uint32_t FixPropertyCloneIds() = 0;
|
||||
};
|
||||
|
||||
#endif //!__IDASHBOARDMAINTENANCE__H__
|
||||
|
||||
@@ -333,10 +333,8 @@ public:
|
||||
nlohmann::json GetCloneOwners(const std::vector<uint32_t>& clones) override;
|
||||
nlohmann::json GetCloneVisitors(uint32_t zoneId, uint32_t cloneId, int64_t from, int64_t to, uint32_t limit) override;
|
||||
uint32_t ApprovePreviouslyApprovedPetNames() override;
|
||||
std::vector<std::pair<LWOOBJID, std::string>> GetAllPetNames() override;
|
||||
void ForEachCharacterXml(const std::function<void(LWOOBJID, const std::string&)>& visit) override;
|
||||
void ForEachCharacterXmlContaining(const std::string& needle, const std::function<void(LWOOBJID, const std::string&)>& visit) override;
|
||||
uint32_t FixPropertyCloneIds() override;
|
||||
std::optional<IAccountEmails::EmailInfo> GetAccountEmail(const uint32_t accountId) override;
|
||||
void SetAccountEmail(const uint32_t accountId, const std::string_view email, const bool confirmed) override;
|
||||
std::optional<uint32_t> GetAccountIdByConfirmedEmail(const std::string_view email) override;
|
||||
|
||||
@@ -339,13 +339,6 @@ uint32_t MySQLDatabase::ApprovePreviouslyApprovedPetNames() {
|
||||
"(SELECT name FROM (SELECT pet_name AS name FROM pet_names WHERE approved = 2) AS approved_names);"));
|
||||
}
|
||||
|
||||
std::vector<std::pair<LWOOBJID, std::string>> MySQLDatabase::GetAllPetNames() {
|
||||
std::vector<std::pair<LWOOBJID, std::string>> pets;
|
||||
auto result = ExecuteSelect("SELECT id, pet_name FROM pet_names;");
|
||||
while (result->next()) pets.emplace_back(result->getInt64("id"), std::string(result->getString("pet_name").c_str()));
|
||||
return pets;
|
||||
}
|
||||
|
||||
void MySQLDatabase::ForEachCharacterXml(const std::function<void(LWOOBJID, const std::string&)>& visit) {
|
||||
auto result = ExecuteSelect("SELECT id, xml_data FROM charxml;");
|
||||
while (result->next()) visit(result->getInt64("id"), std::string(result->getString("xml_data").c_str()));
|
||||
@@ -355,10 +348,3 @@ void MySQLDatabase::ForEachCharacterXmlContaining(const std::string& needle, con
|
||||
auto result = ExecuteSelect("SELECT id, xml_data FROM charxml WHERE LOCATE(?, xml_data) > 0;", needle);
|
||||
while (result->next()) visit(result->getInt64("id"), std::string(result->getString("xml_data").c_str()));
|
||||
}
|
||||
|
||||
uint32_t MySQLDatabase::FixPropertyCloneIds() {
|
||||
return static_cast<uint32_t>(ExecuteUpdate(
|
||||
"UPDATE properties SET clone_id = (SELECT c.prop_clone_id FROM charinfo c WHERE c.id = properties.owner_id) "
|
||||
"WHERE EXISTS (SELECT 1 FROM charinfo c WHERE c.id = properties.owner_id AND c.prop_clone_id IS NOT NULL "
|
||||
"AND (properties.clone_id IS NULL OR c.prop_clone_id != properties.clone_id));"));
|
||||
}
|
||||
|
||||
@@ -317,10 +317,8 @@ public:
|
||||
nlohmann::json GetCloneOwners(const std::vector<uint32_t>& clones) override;
|
||||
nlohmann::json GetCloneVisitors(uint32_t zoneId, uint32_t cloneId, int64_t from, int64_t to, uint32_t limit) override;
|
||||
uint32_t ApprovePreviouslyApprovedPetNames() override;
|
||||
std::vector<std::pair<LWOOBJID, std::string>> GetAllPetNames() override;
|
||||
void ForEachCharacterXml(const std::function<void(LWOOBJID, const std::string&)>& visit) override;
|
||||
void ForEachCharacterXmlContaining(const std::string& needle, const std::function<void(LWOOBJID, const std::string&)>& visit) override;
|
||||
uint32_t FixPropertyCloneIds() override;
|
||||
std::optional<IAccountEmails::EmailInfo> GetAccountEmail(const uint32_t accountId) override;
|
||||
void SetAccountEmail(const uint32_t accountId, const std::string_view email, const bool confirmed) override;
|
||||
std::optional<uint32_t> GetAccountIdByConfirmedEmail(const std::string_view email) override;
|
||||
|
||||
@@ -344,16 +344,6 @@ uint32_t SQLiteDatabase::ApprovePreviouslyApprovedPetNames() {
|
||||
"(SELECT name FROM (SELECT pet_name AS name FROM pet_names WHERE approved = 2) AS approved_names);"));
|
||||
}
|
||||
|
||||
std::vector<std::pair<LWOOBJID, std::string>> SQLiteDatabase::GetAllPetNames() {
|
||||
std::vector<std::pair<LWOOBJID, std::string>> pets;
|
||||
auto [_, result] = ExecuteSelect("SELECT id, pet_name FROM pet_names;");
|
||||
while (!result.eof()) {
|
||||
pets.emplace_back(result.getInt64Field("id"), result.getStringField("pet_name"));
|
||||
result.nextRow();
|
||||
}
|
||||
return pets;
|
||||
}
|
||||
|
||||
void SQLiteDatabase::ForEachCharacterXml(const std::function<void(LWOOBJID, const std::string&)>& visit) {
|
||||
auto [_, result] = ExecuteSelect("SELECT id, xml_data FROM charxml;");
|
||||
while (!result.eof()) {
|
||||
@@ -369,10 +359,3 @@ void SQLiteDatabase::ForEachCharacterXmlContaining(const std::string& needle, co
|
||||
result.nextRow();
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t SQLiteDatabase::FixPropertyCloneIds() {
|
||||
return static_cast<uint32_t>(ExecuteUpdate(
|
||||
"UPDATE properties SET clone_id = (SELECT c.prop_clone_id FROM charinfo c WHERE c.id = properties.owner_id) "
|
||||
"WHERE EXISTS (SELECT 1 FROM charinfo c WHERE c.id = properties.owner_id AND c.prop_clone_id IS NOT NULL "
|
||||
"AND (properties.clone_id IS NULL OR c.prop_clone_id != properties.clone_id));"));
|
||||
}
|
||||
|
||||
@@ -367,10 +367,8 @@ class TestSQLDatabase : public GameDatabase {
|
||||
nlohmann::json GetCloneOwners(const std::vector<uint32_t>& clones) override { return { {"owners", nlohmann::json::array()}, {"properties", nlohmann::json::array()} }; }
|
||||
nlohmann::json GetCloneVisitors(uint32_t zoneId, uint32_t cloneId, int64_t from, int64_t to, uint32_t limit) override { return nlohmann::json::array(); }
|
||||
uint32_t ApprovePreviouslyApprovedPetNames() override { return 0; };
|
||||
std::vector<std::pair<LWOOBJID, std::string>> GetAllPetNames() override { return {}; };
|
||||
void ForEachCharacterXml(const std::function<void(LWOOBJID, const std::string&)>& visit) override {};
|
||||
void ForEachCharacterXmlContaining(const std::string& needle, const std::function<void(LWOOBJID, const std::string&)>& visit) override {};
|
||||
uint32_t FixPropertyCloneIds() override { return 0; };
|
||||
std::optional<IAccountEmails::EmailInfo> GetAccountEmail(const uint32_t accountId) override { return std::nullopt; };
|
||||
void SetAccountEmail(const uint32_t accountId, const std::string_view email, const bool confirmed) override {};
|
||||
std::optional<uint32_t> GetAccountIdByConfirmedEmail(const std::string_view email) override { return std::nullopt; };
|
||||
|
||||
Reference in New Issue
Block a user