LLMS_Processor_Course_Data::init()
Initializer
Return Return
(void)
Source Source
File: includes/processors/class.llms.processor.course.data.php
protected function init() {
// For the cron.
add_action( $this->schedule_hook, array( $this, 'dispatch_calc' ), 10, 1 );
// For LifterLMS actions which trigger recalculation.
$this->actions = array(
'llms_course_calculate_data' => array(
'arguments' => 1,
'callback' => 'schedule_calculation',
'priority' => 10,
),
'llms_user_enrolled_in_course' => array(
'arguments' => 2,
'callback' => 'schedule_from_course',
'priority' => 10,
),
'llms_user_removed_from_course' => array(
'arguments' => 2,
'callback' => 'schedule_from_course',
'priority' => 10,
),
'lifterlms_lesson_completed' => array(
'arguments' => 2,
'callback' => 'schedule_from_lesson',
'priority' => 10,
),
'lifterlms_quiz_completed' => array(
'arguments' => 3,
'callback' => 'schedule_from_quiz',
'priority' => 10,
),
);
/**
* Throttles course data processing based on the number of a students in a course.
*
* If the number of students in a course is greater than or equal to this number, the background
* process will be throttled to run only once every N hours where N is equal to the number of hours
* defined by the `llms_data_processor_course_data_throttle_frequency` filter.
*
* @since 3.15.0
* @since 4.12.0 Reduced default value of `$number_students` from 2500 to 500.
*
* @see llms_data_processor_course_data_throttle_frequency
*
* @param int $number_students The number of students. Default is `500`.
* @param LLMS_Processor_Course_Data $processor Instance of the data processor class.
*/
$this->throttle_max_students = apply_filters( 'llms_data_processor_course_data_throttle_count', 500, $this );
/**
* Frequency to run the processor for a given course when processing is throttled
*
* @since 3.15.0
*
* @see llms_data_processor_course_data_throttle_count
*
* @param int $frequency Frequency of the calculation process in seconds. Default `HOUR_IN_SECONDS * 4`.
* @param LLMS_Processor_Course_Data $processor Instance of the data processor class.
*/
$this->throttle_frequency = apply_filters( 'llms_data_processor_course_data_throttle_frequency', HOUR_IN_SECONDS * 4, $this );
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 3.15.0 | Introduced. |