Whats the best way to get a scheduled job (once a day) that makes a update in the database? My first idea was to use "Ad-hoc database queries" but it was not possible because db writing is not allowed.
The use case is that we would add a role (insert a new post in mdl_role_assignments) for users that fullfils some preconditions and have this done every night.
Do I need to use the Task API and create a new class for this?