LLMS_Processor_Course_Data::schedule_calculation( int $course_id, int $time = null )
Schedule a calculation to execute
Description Description
This will schedule an event that will setup the queue of items for the background process.
Parameters Parameters
- $course_id
-
(int) (Required) WP Post ID of the course.
- $time
-
(int) (Optional) y pass a timestamp for when the event should be run.
Default value: null
Return Return
(void)
Source Source
File: includes/processors/class.llms.processor.course.data.php
public function schedule_calculation( $course_id, $time = null ) {
$course_id = absint( $course_id );
$this->log( sprintf( 'Course data calculation triggered for course %d.', $course_id ) );
$args = array( $course_id );
if ( ! wp_next_scheduled( $this->schedule_hook, $args ) ) {
$time = ! $time ? time() : $time;
wp_schedule_single_event( $time, $this->schedule_hook, $args );
$this->log( sprintf( 'Course data calculation scheduled for course %d.', $course_id ) );
}
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 4.21.0 | Force $course_id to an absolute integer to avoid duplicate scheduling resulting from loose variable typing. |
| 3.15.0 | Introduced. |