Bug in Subscribe2 ReadyGraph extension makes wp_options cron grow infinitely
-
The wp_options table “cron” entry was growing ever larger and being rewritten on ever page view for a customer’s site we host. The entries were all for “rg_cron_hook”.
This is because Subscribe2’s readygraph-extension.php contains a bug at lines 108-110 in version 10.11:
if ($send_blog_updates == 'true'){ if( !wp_next_scheduled( 'rg_cron_hook' && $send_blog_updates == 'true')) { wp_schedule_event( time(), 'weekly', 'rg_cron_hook' );
The “$send_blog_updates == ‘true'” of the second line duplicates the first, and the duplication contains a bug anyway because one of the closing parentheses is in the wrong place. It should look like this if it was trying to separately test whether wp_next_scheduled is FALSE and $send_blog_updates is true:
if( !wp_next_scheduled( 'rg_cron_hook') && $send_blog_updates == 'true') {
The misplaced parenthesis causes the wp_schedule_event() to run even when there’s already an event scheduled, resulting in a new event being added for every page view. And it turns out that WordPress does not deal well with tens of thousands of scheduled events.
This is presumably what these lines should look like:
if ($send_blog_updates == 'true'){ if( !wp_next_scheduled( 'rg_cron_hook')) { wp_schedule_event( time(), 'weekly', 'rg_cron_hook' );
- The topic ‘Bug in Subscribe2 ReadyGraph extension makes wp_options cron grow infinitely’ is closed to new replies.