Where does Moodle store external db config strings?

Where does Moodle store external db config strings?

by Alan Zaitchik -
Number of replies: 2
I would like my cron job to have access to the configuration strings stored by Moodle when I configured external DB enrollment-- e.g. database name, host, db type, db user, password, and so on.
Where does Moodle save these values? Are they available through some global like the "$CFG" variables in config.php are, for Moodle's own internal database?
Thanks!

Average of ratings: -
In reply to Alan Zaitchik

Re: Where does Moodle store external db config strings?

by Dan Marsden -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers Picture of Plugins guardians Picture of Testers Picture of Translators
those settings are "saved" in the config.php file, they are accessible to other php scripts using $CFG by including the config.php file like this:

require_once("/home/dan/moodle/config.php");
global $CFG;

(where /home/dan/moodle is the path to your moodle site.)

hope that helps.

thanks,

smile

Dan
In reply to Dan Marsden

Re: Where does Moodle store external db config strings?

by Alan Zaitchik -
I was looking for the settings for the external enrollment db, not the local MySQL db. But poking around I found them the in mdl_config table. I used the values in the config.php file you pointed me to in order to have the cron job connect to the local MySQL db, get the right values from the msl_config table, connect to the external db, and get what it needs.
So in the end it all worked out!
Thanks for you help.
Alan