# HG changeset patch # User Kim Alvefur # Date 1666012806 -7200 # Node ID 1dd468c63a3d3a70ed46542cdab110307934d590 # Parent fc4adc32a537f84422fca2c3f5c077d7e4fcacd0 mod_blocklist: Add option 'migrate_legacy_blocking' to disable migration from mod_privacy Tiny performance improvement for new users by skipping this check. Most servers should have gone trough the migration for all active users long ago. As a suitable first step of phasing out this code, we make it possible to disable it first. Later it can be disabled by default, before finally the code is deleted. diff -r fc4adc32a537 -r 1dd468c63a3d CHANGES --- a/CHANGES Mon Oct 17 15:13:04 2022 +0200 +++ b/CHANGES Mon Oct 17 15:20:06 2022 +0200 @@ -33,6 +33,7 @@ ## Changes - Support sub-second precision timestamps +- mod_blocklist: New option 'migrate_legacy_blocking' to disable migration from mod_privacy ## Removed diff -r fc4adc32a537 -r 1dd468c63a3d plugins/mod_blocklist.lua --- a/plugins/mod_blocklist.lua Mon Oct 17 15:13:04 2022 +0200 +++ b/plugins/mod_blocklist.lua Mon Oct 17 15:20:06 2022 +0200 @@ -54,6 +54,7 @@ end -- Migrates from the old mod_privacy storage +-- TODO mod_privacy was removed in 0.10.0, this should be phased out local function migrate_privacy_list(username) local legacy_data = module:open_store("privacy"):get(username); if not legacy_data or not legacy_data.lists or not legacy_data.default then return; end @@ -77,6 +78,13 @@ return migrated_data; end +if not module:get_option_boolean("migrate_legacy_blocking", true) then + migrate_privacy_list = function (username) + module:log("debug", "Migrating from mod_privacy disabled, user '%s' will start with a fresh blocklist", username); + return nil; + end +end + local function get_blocklist(username) local blocklist = cache2:get(username); if not blocklist then