1
0
mirror of https://github.com/anope/anope.git synced 2026-06-12 17:04:47 +02:00

Add an option to not preserve old data in db_json.

This commit is contained in:
Sadie Powell
2025-11-10 17:16:21 +00:00
parent 88785bfdef
commit 1ce39c8e76
2 changed files with 16 additions and 0 deletions
+12
View File
@@ -1147,8 +1147,20 @@ module
* Allows Anope to continue writing the database even if the original can
* not be backed up. This is not recommended as it may result in total data
* loss during the circumstances described above.
*
* Defaults to no.
*/
#ignore_backup_failure = yes
/*
* Whether to preserve unknown data within the database. When a module is
* unloaded its data will be kept in the database so that it continues to
* function when reloaded. You can turn this off to clean up unknown data
* on the next database write.
*
* Defaults to yes.
*/
#preserve_unknown_data = no
}
/*
+4
View File
@@ -363,6 +363,10 @@ public:
void OnSaveDatabase() override
{
// Step 0: clear the old data if we don't want to preserve it.
if (!Config->GetModule(this).Get<bool>("preserve_unknown_data", "yes"))
databases.clear();
// Step 1: clear the old data.
for (const auto &type : Serialize::Type::GetTypeOrder())
{