Im developing an admin tool plugin, that do a scheduled task once a day.
The problem is, i want to save a log file of all that process, a log that i made myself, so, in the "execute" function, i place all my logic there, and then in the end of the process, i do a fopen, fwrite and then a fclose to save my log file.
When the moodle cron execute, right a this exact point, i get this message:
A lock was created but not released at:
[dirroot]\lib\cronlib.php on line 99
if i remove the fopen, fwrite and fclose, everything works smoothly.
i tryed to use file_put_contents, i got the same error.
If i run this code outside of cron, it works just fine, and save my log file successfully.
What is the problem? moodle blocks file creation in cron or something?