| @@ -206,9 +206,9 @@ | ||
| 206 | 206 | * Activates the plugin on a particular blog instance (supports multisite and single site). |
| 207 | 207 | */ |
| 208 | 208 | private function activate_on_site() { |
| 209 | 209 | wp_clear_scheduled_hook( 'visualizer_schedule_refresh_db' ); |
| 210 | - wp_schedule_event( strtotime( 'midnight' ) - get_option( 'gmt_offset' ) * HOUR_IN_SECONDS, 'hourly', 'visualizer_schedule_refresh_db' ); | |
| 210 | + wp_schedule_event( strtotime( 'midnight' ) - get_option( 'gmt_offset' ) * HOUR_IN_SECONDS, apply_filters( 'visualizer_chart_schedule_interval', 'hourly' ), 'visualizer_schedule_refresh_db' ); | |
| 211 | 211 | add_option( 'visualizer-activated', true ); |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | /** |
| @@ -393,8 +393,13 @@ | ||
| 393 | 393 | } |
| 394 | 394 | |
| 395 | 395 | // if the time is nigh, we force an update. |
| 396 | 396 | $this->refresh_db_for_chart( null, $chart_id, true ); |
| 397 | + // Clear existing chart cache. | |
| 398 | + $cache_key = Visualizer_Plugin::CF_CHART_CACHE . '_' . $chart_id; | |
| 399 | + if ( get_transient( $cache_key ) ) { | |
| 400 | + delete_transient( $cache_key ); | |
| 401 | + } | |
| 397 | 402 | $hours = get_post_meta( $chart_id, Visualizer_Plugin::CF_DB_SCHEDULE, true ); |
| 398 | 403 | $new_schedules[ $chart_id ] = time() + $hours * HOUR_IN_SECONDS; |
| 399 | 404 | } |
| 400 | 405 | update_option( Visualizer_Plugin::CF_DB_SCHEDULE, $new_schedules ); |