File "3.0.3-usage-tracking-schedule.php"

Full Path: /home/tekvhqgl/public_html/wp-content/plugins/mailchimp-for-wp/includes/admin/migrations/3.0.3-usage-tracking-schedule.php
File size: 713 bytes
MIME-type: text/x-php
Charset: utf-8

<?php
defined( 'ABSPATH' ) or exit;

$options = (array) get_option( 'mc4wp', array() );
if ( empty( $options['allow_usage_tracking'] ) ) {
	return;
}

// usage tracking is enabled, reschedule it so it uses new cron schedule.

// make sure 'monthly' cron schedule is registered
/**
 * @ignore
 */
function _mc4wp_303_add_monthly_cron_schedule( $schedules ) {
	$schedules['monthly'] = array(
		'interval' => 30 * DAY_IN_SECONDS,
		'display'  => 'Once a month',
	);

	return $schedules;
}

add_filter( 'cron_schedules', '_mc4wp_303_add_monthly_cron_schedule', 1 );

// reschedule usage tracking event
wp_clear_scheduled_hook( 'mc4wp_usage_tracking' );
wp_schedule_event( time(), 'monthly', 'mc4wp_usage_tracking' );