See Release Notes
Long Term Support Release
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 |
refreshfeeds:: (4 methods):
get_name()
execute()
fetch_feed()
calculate_skiptime()
Class: refreshfeeds - X-Ref
Task for updating RSS feeds for rss client blockget_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. |