Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

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

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