Skip to content

IP logging keeps getting re-enabled after updates #392

Closed

Description

@EusebiuOprinoiu

Describe the bug

Hello, Ben!

The "Log Blocked IPs" toggle keeps getting re-enabled after an update.
The behavior is very inconsistent. On some websites, this toggle was turned on after every recent update. On others, it remained disabled.
I noticed that on websites that use Redis, the problem occurs almost every time, whereas on those without Redis, it occurs only sometimes.

Steps to Reproduce

  1. Disable the "Log Blocked IPs" toggle
  2. Push an update to Zero Spam
  3. Check the "Log Blocked IPs" toggle

Screenshots, screen recording, code snippet

No response

Environment information

No response

WordPress information

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Activity

  1. added 2 commits that reference this issue on Mar 16, 2026
  2. bmarshall511 commented on Mar 16, 2026

    @bmarshall511
    Collaborator

    Root cause identified and fixed.

    The Updates class ran a migration from the legacy wpzerospam option to per-module zero-spam-{module} options on every plugin version bump, not just once. Each time, it blindly overwrote current user settings with stale values from the old option — causing settings like "Log Blocked IPs" to re-enable themselves. The issue was more consistent on Redis-based sites because the old option persisted reliably in the object cache.

    Fix (branch fix/392-settings-reset-on-update):

    Replaced the Updates class with a Migrations runner that tracks completed migrations by unique key — each migration runs exactly once
    The legacy migration now only fills in missing keys and never overwrites existing user settings
    The stale wpzerospam option is deleted after migration with explicit cache flushing for Redis/Memcached
    A one-time admin notice prompts users to verify their settings after upgrading
    Files changed: includes/class-migrations.php (new), includes/class-updates.php (deleted), includes/class-plugin.php, core/admin/class-admin.php, core/admin/class-settings.php, uninstall.php

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions