admin setting

Re: admin setting

by Davo Smith -
Number of replies: 0
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin 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).