Skip to:

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#4792 closed defect (bug) (fixed)

bp_activity_akismet_delete_old_metadata is NOT firing in WP-cron, leading to massive potential DB bloat.

Reported by: rossagrant Owned by:
Milestone: 1.7 Priority: normal
Severity: normal Version: 1.6
Component: Activity Keywords:


Creating a ticket after replicating this issue on 3 separate installs of BP and WP.

It appears that the wp-cron job bp_activity_akismet_delete_old_metadata ISN'T firing on any BP installs.

I can't track back to at which version this began being a problem unfortunately, but it wasn't an issue in BP 1.5 from what I can remember.

Steps to replicate:

  • Install BP 1.6.x and WP 3.5
  • Now to see which jobs are in cron, you're going to need a backend plugin such as the very stable WP-Cron dashboard - (not been updated for a while, but works just fine).
  • You'll see all of the jobs in cron, but you'll notice that bp_activity_akismet_delete_old_metadata has a big X next to it saying "X - no action exists with this name".
  • Now of course, I first thought this could be a plugin not reading the job properly, but after inspecting the DB and the activity_meta entries table, NO daily clear-outs of this table have been made in months.

This cron job should run once daily to empty the meta table which contains all sorts of stuff such as Akismet calls for the activity stream (when the option is checked to use Akismet in the backend.)

However there is an actual error with the Akismet option, which was reported in this thread here:

So even when the Akismet box for BP in the options is UNCHECKED, Akismet is STILL queried for the activity stream.

There is a separate ticket for this issue and it doesn't affect the main issue of the job not firing:

See here:

As further proof that the cron job is not firing, the user in that ticket also reports that he has 25k meta entries that IF THIS CRON WAS WORKING would have been cleared out regardless of the Akismet bug.

So we need to find out what has gone wrong with this action and why it isn't firing.

It will have gone unnoticed for ages as unless you check wp-cron with a plugin or look at your DB regularly, you would never have noticed anything odd.

I have replicated this on 3 separate server environments, so I'm confident it's not server related or plugin related as I've tried it on a vanilla install in BP-Default with NO plugins.

If you need me to test anything at all, please shout up! :)

Change History (6)

#1 @DJPaul
9 years ago

  • Component changed from Core to Activity
  • Version set to 1.6

#2 @boonebgorges
9 years ago

  • Keywords has-patch needs-testing added
  • Milestone changed from Awaiting Review to 1.7

Maybe I'm missing something, but it looks like it's just that the hook is missing. The event is being set correctly as bp_activity_akismet_delete_old_metadata, and there's a function by the same name. But registering an event with wp-cron does not mean registering a *callback*, it means registering a *hook*. So what we need is probably as simple as

add_action( 'bp_activity_akismet_delete_old_metadata', 'bp_activity_akismet_delete_old_metadata' );

rossagrant, would you mind dropping that into a file somewhere (bp-activity/bp-activity-akismet.php would be fine) and seeing if it does the trick?

#3 @rossagrant
9 years ago

That does the trick Boone!

Dropped it into bp-activity/bp-activity-akismet.php and the cron job is now showing as a existing action.

Looks good to me, we can probably close this bad boy up!

#4 @boonebgorges
9 years ago

  • Keywords has-patch needs-testing removed

Thanks for checking, rossagrant!

#5 @boonebgorges
9 years ago

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

(In [6825]) Hook bp_activity_akismet_delete_old_metadata to the appropriate hook, so it runs on the wp-cron job

Fixes #4792

#6 @rossagrant
9 years ago

Pleasure, nice teamwork chaps!

Note: See TracTickets for help on using tickets.