LLMS_Install::create_cron_jobs()

Create LifterLMS cron jobs


Return Return

(void)


Top ↑

Source Source

File: includes/class.llms.install.php

	public static function create_cron_jobs() {

		$crons = array(
			array(
				/**
				 * Filter the recurrence interval at which files in the LifterLMS logs are scanned and backed up.
				 *
				 * @since 4.5.0
				 *
				 * @link https://developer.wordpress.org/reference/functions/wp_get_schedules/
				 *
				 * @param string $recurrence Cron job recurrence interval. Must be valid interval as retrieved from `wp_get_schedules()`. Default is "daily".
				 */
				'hook'     => 'llms_backup_logs',
				'interval' => apply_filters( 'llms_backup_logs_interval', 'daily' ),
			),
			array(
				/**
				 * Filter the recurrence interval at which files in the LifterLMS tmp directory are cleaned.
				 *
				 * @since 4.5.0
				 *
				 * @link https://developer.wordpress.org/reference/functions/wp_get_schedules/
				 *
				 * @param string $recurrence Cron job recurrence interval. Must be valid interval as retrieved from `wp_get_schedules()`. Default is "daily".
				 */
				'hook'     => 'llms_cleanup_tmp',
				'interval' => apply_filters( 'llms_cleanup_tmp_interval', 'daily' ),
			),
			array(
				'hook'     => 'llms_send_tracking_data',
				/**
				 * Filter the recurrence interval at which tracking data is gathered and sent.
				 *
				 * @since Unknown
				 *
				 * @link https://developer.wordpress.org/reference/functions/wp_get_schedules/
				 *
				 * @param string $recurrence Cron job recurrence interval. Must be valid interval as retrieved from `wp_get_schedules()`. Default is "daily".
				 */
				'interval' => apply_filters( 'llms_tracker_schedule_interval', 'daily' ),
			),
			array(
				'hook'     => 'llms_delete_expired_session_data',
				/**
				 * Filter the recurrence interval at which expired session are removed from the database.
				 *
				 * @since 4.0.0
				 *
				 * @link https://developer.wordpress.org/reference/functions/wp_get_schedules/
				 *
				 * @param string $recurrence Cron job recurrence interval. Must be valid interval as retrieved from `wp_get_schedules()`. Default is "hourly".
				 */
				'interval' => apply_filters( 'llms_delete_expired_session_data_recurrence', 'hourly' ),
			),
		);

		foreach ( $crons as $data ) {
			if ( ! wp_next_scheduled( $data['hook'] ) ) {
				wp_schedule_event( time(), $data['interval'], $data['hook'] );
			}
		}

	}


Top ↑

Changelog Changelog

Changelog
Version Description
4.5.0 Add log backup cron.
4.0.0 Add expired session cleanup.
3.28.0 Remove unused cronjob lifterlms_cleanup_sessions.
1.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.