Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Task for updating RSS feeds for rss client block

Author: Farhan Karmali <farhan6318@gmail.com>
Copyright: Farhan Karmali 2018
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 151 lines (6 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

refreshfeeds:: (4 methods):
  get_name()
  execute()
  fetch_feed()
  calculate_skiptime()


Class: refreshfeeds  - X-Ref

Task for updating RSS feeds for rss client block

get_name()   X-Ref
Name for this task.

return: string

execute()   X-Ref
This task goes through all the feeds. If the feed has a skipuntil value
that is less than the current time cron will attempt to retrieve it
with the cache duration set to 0 in order to force the retrieval of
the item and refresh the cache.

If a feed fails then the skipuntil time of that feed is set to be
later than the next expected task time. The amount of time will
increase each time the fetch fails until the maximum is reached.

If a feed that has been failing is successfully retrieved it will
go back to being handled as though it had never failed.

Task should therefore process requests for permanently broken RSS
feeds infrequently, and temporarily unavailable feeds will be tried
less often until they become available again.

fetch_feed(string $url)   X-Ref
Fetch a feed for the specified URL.

param: string  $url The URL to fetch
return: \moodle_simplepie

calculate_skiptime(int $currentskip)   X-Ref
Calculates a new skip time for a record based on the current skip time.

param: int     $currentskip The current skip time of a record.
return: int     The newly calculated skip time.