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:
@@ -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
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -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())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user