Skip to:
Content

bbPress.org

Opened 14 months ago

Closed 4 weeks ago

Last modified 4 weeks ago

#3395 closed enhancement (fixed)

Akismet spam cleanup functionality

Reported by: stephdau Owned by: johnjamesjacoby
Milestone: 2.6.7 Priority: high
Severity: normal Version:
Component: Extend - Akismet Keywords: has-patch commit
Cc:

Description

This was first proposed on Slack here.

In the WP AK plugin, we have a scheduled function Akismet::delete_old_comments_meta() to delete old akismet_as_submitted meta records, because they are pretty large, and not useful at all after a while.

Since then, @johnjamesjacoby suggested:

We could go as far as moving it out of post meta and into a custom post type with a post_parent relationship to the topic/reply. That would allow for some longer data retention, without the surplus of metadata keys.

I'm attaching a patch with what I had started before JJJ add his comment, since I have it, but leaving any fancier concept to the bbPress team to bounce around.

Note that my patch does not actually have the scheduling of said cleanup, as I wasn't sure where it would be best to trigger that in bbPress. See:

/**
 * The above will need to be scheduled with something like:
 * if ( ! wp_next_scheduled( 'akismet_scheduled_delete' ) ) {
 * 	wp_schedule_event( time(), 'daily', 'akismet_scheduled_delete' );
 * }
 */

Also note that the patch in wholly untasted, since I didn't get to keep going. :)

Attachments (2)

3395.diff (5.9 KB) - added by stephdau 14 months ago.
3395.2.diff (8.6 KB) - added by johnjamesjacoby 6 weeks ago.

Download all attachments as: .zip

Change History (13)

@stephdau
14 months ago

#1 @stephdau
14 months ago

Another not: I will be off on a sabbatical in Sept/Oct/Nov, so I'll tag my fellow Akismet devs on this ticket, so they can keep up with it, and your team.

Ping @cfinke and @procifer. Tag! ;p

Version 0, edited 14 months ago by stephdau (next)

#2 @johnjamesjacoby
10 months ago

  • Keywords has-patch needs-testing added
  • Milestone changed from Awaiting Review to 2.7
  • Owner set to johnjamesjacoby
  • Priority changed from normal to high
  • Status changed from new to assigned

Patch looks really good to me. Let's milestone this for 2.7, and I'll be sure to test this thoroughly then. 🙏

#3 @stephdau
10 months ago

Thanks!

#4 @stephdau
6 weeks ago

Any chance this could make it in sooner rather than later?
It's been 13 months now. :)

#5 @johnjamesjacoby
6 weeks ago

3395.2.diff includes the following changes:

  • Removed/improved some related code docs
  • Replace return; statements with break; inside of while loops, so that table optimizations still run
  • Pass more variables into hooks, to make them potentially more useful later
  • Add a maybe_optimize_postmeta() method to encapsulate some repeated code
  • Add docs on filters
  • Relocate filter names, because I think they were inverted (count vs. batch)?

@stephdau what do you think, old friend? 🍕

#6 @stephdau
6 weeks ago

Looks brilliant. Thanks!

#7 @johnjamesjacoby
4 weeks ago

  • Keywords commit added; needs-testing removed
  • Milestone changed from 2.7 to 2.6.7

#8 @johnjamesjacoby
4 weeks ago

In 7203:

Akismet: introduce a few clean-up action hook methods.

  • delete_old_spam() - deletes old spam topics & replies from the queue after 15 days.
  • delete_old_spam_meta() - deletes _bbp_akismet_as_submitted entries after 15 days.
  • delete_orphaned_spam_meta() - deletes post meta that no longer have corresponding posts in the database.

Props stephdau, johnjamesjacoby.

In branches/2.6, for 2.6.7.

See #3395.

#9 @johnjamesjacoby
4 weeks ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 7204:

Akismet: introduce a few clean-up action hook methods.

  • delete_old_spam() - deletes old spam topics & replies from the queue after 15 days.
  • delete_old_spam_meta() - deletes _bbp_akismet_as_submitted entries after 15 days.
  • delete_orphaned_spam_meta() - deletes post meta that no longer have corresponding posts in the database.

Props stephdau, johnjamesjacoby.

In trunk, for 2.7.0.

Fixes #3395.

#10 @johnjamesjacoby
4 weeks ago

In 7205:

Akismet: hook clean-up methods from r7203 into WP Cron.

This change takes stephdau's advice and schedules a daily cron on the akismet_scheduled_delete event (but only when actually adding to the Akismet post histories, to try to narrow the scope slightly).

In branches/2.6, for 2.6.7.

See #3395.

#11 @johnjamesjacoby
4 weeks ago

In 7206:

Akismet: hook clean-up methods from r7204 into WP Cron.

This change takes stephdau's advice and schedules a daily cron on the akismet_scheduled_delete event (but only when actually adding to the Akismet post histories, to try to narrow the scope slightly).

In trunk, for 2.7.0.

See #3395.

Note: See TracTickets for help on using tickets.