Save value of a scheduled task

Save value of a scheduled task

von saleh refaai -
Anzahl Antworten: 3

I am developing a plugin that works in a scheduled time (run each 12 hours). I am trying to read a value from the first row of a moodle table, then check if this value persists in the table for more than 12 hours then get a notification.  I don't want to create a table to save the timestamp and the value. 

How can I save the value for the next scheduled run and compare it with the current value to check if it is still the same value? 

Als Antwort auf saleh refaai

Re: Save value of a scheduled task

von Tim Hunt -
Nutzerbild von Core developers Nutzerbild von Documentation writers Nutzerbild von Particularly helpful Moodlers Nutzerbild von Peer reviewers Nutzerbild von Plugin developers
Can you use get_config / set_config?
Als Antwort auf Tim Hunt

Re: Save value of a scheduled task

von saleh refaai -
Thank you for your quick reply.

I can use the get_config / set_config but is it safe to use it just to save some value?
Als Antwort auf saleh refaai

Re: Save value of a scheduled task

von Mark Johnson -
Nutzerbild von Core developers Nutzerbild von Particularly helpful Moodlers Nutzerbild von Peer reviewers Nutzerbild von Plugin developers

Yes, it will write it to the mdl_config_plugins table. As long as you save it against your plugin's name and a unique identifier within your plugin, it will not interfere with any other values.