General developer forum

admin setting

 
Davo
Re: admin setting
Core developersParticularly helpful MoodlersPlugin developers

I'm not really sure how many other ways I can put this.

If you want to insert / update / delete a record in mdl_config_plugins, use set_config() - don't manually access that DB table as this will mean the cache will be out of date.

You can look at the code for it if you really want - it's all available here: https://github.com/moodle/moodle/blob/master/lib/moodlelib.php#L1383

As you can clearly see from the code - if there is no entry for that config setting, then a new record will be inserted, if there is an existing value, then it will be updated and if the value you are setting is null, then the existing record will be deleted or not inserted (as appropriate).


 
Average of ratings: -