Highfivery / zero-spam-for-wordpress

The WordPress Zero Spam plugin makes blocking spam a cinch without all the bloated options. Just install, activate, and say goodbye to spam.
https://wordpress.org/plugins/zero-spam/
73 stars 32 forks source link

fix DB update error for multisite installations #281

Closed macbookandrew closed 2 years ago

macbookandrew commented 2 years ago

On a multisite installation, the plugin currently uses get_site_option() to read the current version but update_option() to set it after the DB update.

In my instance, I had the plugin network-activated, and every pageload resulted in 20s of latency while it ran the DB updates.

Once the DB updates were complete, it would write a site option, but on the next pageload, it would read from the (unset) network option, and run the DB updates again.

This PR resolves the issue by using update_site_option() instead, which falls back to update_option() when not in multisite.

bmarshall511 commented 2 years ago

@macbookandrew Looks good, thanks for the fix and contribution!

bmarshall511 commented 2 years ago

@macbookandrew Your fix was just released with v5.2.2, thanks again!

If you've got time, would you mind reviewing the plugin: https://wordpress.org/plugins/zero-spam/, I'd really appreciate it. The more that use this, the stronger it becomes to protect sites.