From 516d67a8c51d78bc86426d6661ad0a28f8340639 Mon Sep 17 00:00:00 2001 From: LunarCapsule127 Date: Sat, 29 Aug 2026 21:29:21 +0100 Subject: [PATCH 1/4] Update __manifest__.py --- spp_attachment_av_scan/__manifest__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spp_attachment_av_scan/__manifest__.py b/spp_attachment_av_scan/__manifest__.py index d8f6caa2..0da47c30 100644 --- a/spp_attachment_av_scan/__manifest__.py +++ b/spp_attachment_av_scan/__manifest__.py @@ -1,7 +1,7 @@ { # pylint: disable=pointless-statement "name": "OpenSPP Attachment Antivirus Scan", "category": "OpenSPP", - "version": "19.0.2.1.0", + "version": "19.0.2.2.0", "sequence": 1, "author": "OpenSPP.org", "website": "https://github.com/OpenSPP/OpenSPP2", From c4db10dc96a72d70bdb9d7a00499bce7da0f582b Mon Sep 17 00:00:00 2001 From: LunarCapsule127 Date: Sat, 29 Aug 2026 21:30:06 +0100 Subject: [PATCH 2/4] Update quarantine_cron.xml --- spp_attachment_av_scan/data/quarantine_cron.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spp_attachment_av_scan/data/quarantine_cron.xml b/spp_attachment_av_scan/data/quarantine_cron.xml index 7dfec792..ef0393bd 100644 --- a/spp_attachment_av_scan/data/quarantine_cron.xml +++ b/spp_attachment_av_scan/data/quarantine_cron.xml @@ -1,5 +1,5 @@ - + Purge Old Quarantined Files From d9998848a2a9aed906081ab8a7143b66da2fe9a2 Mon Sep 17 00:00:00 2001 From: LunarCapsule127 Date: Sat, 29 Aug 2026 21:31:23 +0100 Subject: [PATCH 3/4] Create post-migrate.py --- .../migrations/19.0.2.2.0/post-migrate.py | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 spp_attachment_av_scan/migrations/19.0.2.2.0/post-migrate.py diff --git a/spp_attachment_av_scan/migrations/19.0.2.2.0/post-migrate.py b/spp_attachment_av_scan/migrations/19.0.2.2.0/post-migrate.py new file mode 100644 index 00000000..b73eb382 --- /dev/null +++ b/spp_attachment_av_scan/migrations/19.0.2.2.0/post-migrate.py @@ -0,0 +1,36 @@ +import logging + +_logger = logging.getLogger(__name__) + +_RECORDS = ( + "ir_cron_purge_quarantined_files", + "ir_cron_cleanup_forensic_downloads", + "config_param_quarantine_retention_days", + "config_param_forensic_download_retention_hours", +) + + +def migrate(cr, version): + """Protect admin-tuned quarantine crons/params from upgrade resets. + + The records in ``data/quarantine_cron.xml`` are now declared + ``noupdate="1"``, but that flag is only honored when a record is first + created. On any database that installed this module before the flag was + added, the ``ir.model.data`` rows already exist with ``noupdate = False``, + so every upgrade keeps rewriting them to the shipped defaults. Flip the + flag on the existing rows; leave the stored values untouched so an admin's + tuning survives and untouched defaults stay as shipped. + """ + cr.execute( + """ + UPDATE ir_model_data + SET noupdate = TRUE + WHERE module = 'spp_attachment_av_scan' + AND name IN %s + """, + (_RECORDS,), + ) + _logger.info( + "spp_attachment_av_scan: set noupdate on %s quarantine cron/param records", + cr.rowcount, + ) From 0242d5428a7d5c8d27c7d98bac1e5062cd9a7fc6 Mon Sep 17 00:00:00 2001 From: LunarCapsule127 Date: Sat, 29 Aug 2026 21:36:29 +0100 Subject: [PATCH 4/4] Update test_pending_scan_sweep.py --- spp_attachment_av_scan/tests/test_pending_scan_sweep.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spp_attachment_av_scan/tests/test_pending_scan_sweep.py b/spp_attachment_av_scan/tests/test_pending_scan_sweep.py index 929d7b58..0f23ba87 100644 --- a/spp_attachment_av_scan/tests/test_pending_scan_sweep.py +++ b/spp_attachment_av_scan/tests/test_pending_scan_sweep.py @@ -401,6 +401,10 @@ def test_the_cron_and_config_defaults_are_not_reset_by_a_module_upgrade(self): "config_param_pending_sweep_min_age_minutes", "config_param_pending_sweep_batch_size", "config_param_pending_sweep_max_attempts", + "ir_cron_purge_quarantined_files", + "ir_cron_cleanup_forensic_downloads", + "config_param_quarantine_retention_days", + "config_param_forensic_download_retention_hours", ): with self.subTest(record=name): imd = self.env["ir.model.data"].search([("module", "=", "spp_attachment_av_scan"), ("name", "=", name)])