Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

Differences Between: [Versions 310 and 402] [Versions 311 and 402] [Versions 39 and 402] [Versions 400 and 402] [Versions 401 and 402]

A scheduled task for forum cron.

Copyright: 2014 Dan Poltawski <dan@moodle.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 546 lines (20 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: cron_task  - X-Ref

The main scheduled task for the forum.

get_name()   X-Ref
Get a descriptive name for this task (shown to admins).

return: string

execute()   X-Ref
Execute the scheduled task.


process_post_data($posts)   X-Ref
Process all posts and convert to appropriated hoc tasks.

param: \stdClass[] $posts

fill_course_cache($courseids)   X-Ref
Fill the course cache.

param: int[]       $courseids

fill_forum_cache($forumids)   X-Ref
Fill the forum cache.

param: int[]       $forumids

fill_discussion_cache($discussionids)   X-Ref
Fill the discussion cache.

param: int[]       $discussionids

fill_digest_cache()   X-Ref
Fill the cache of user digest preferences.


add_data_for_post($post)   X-Ref
Add dsta for the current forum post to the structure of adhoc data.

param: \stdClass   $post

fill_user_subscription_cache()   X-Ref
Fill the cache of user subscriptions.


queue_user_tasks()   X-Ref
Queue the user tasks.


fetch_posts_for_user($user)   X-Ref
Fetch posts for this user.

param: \stdClass   $user The user to fetch posts for.

get_unmailed_posts($starttime, $endtime, $now = null)   X-Ref
Returns a list of all new posts that have not been mailed yet

param: int $starttime posts created after this time
param: int $endtime posts created before this
param: int $now used for timed discussions only
return: array