We have over 60 moodle sites and are bringing new ones up regularly. They ALL are set up to Mnet to each other.
We are trying to develop a custom config procedure that makes sure certain user accounts are created within moodle (if they arent already there, and assigned as site admins.
This same procedure is also checking against a master list of moodle sites and making sure that each particular site is on the master list, and that all the other sites on the master list are configured as Mnet Peers.
The script I wrote is populating the mnet_host table correctly (I think) for the additional sites. And it is also adding records to mnet_host2config.
The problem I'm having is that none of the sites I'm adding by this procedure show up as peers in Moodle. If I try to add a site manually I can't due to an error reporting that the site exists. If I click on the edit link I get a fatal error.
Obviously I'm missing something, but I can't find what it would be. Ive attached the script we are testing to this question for your reference.
Id appreciate a second set of eyes.