Backup and restore of enrolment plugins

Backup and restore of enrolment plugins

by Howard Miller -
Number of replies: 5
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Bit of a long shot...

I wrote a custom enrolment plugin a long time ago. It extends the database enrolment plugin and does a few extra things. Nothing exciting. 

However, I can't get it to work properly with backup and restore. It has a load of custom settings using customintX and customtextX fields. When a course is restored (with appropriate settings) the instance of the enrol plugin restores but loses all of its settings. They appear to just be a default, new instance. 

I'm not sure what I'm missing - the various restore_ functions are shared with enrol_database which obviously works. 

Any thoughts / places to look?

Average of ratings: -
In reply to Howard Miller

Backup and restore of enrolment plugins

by Michael Hughes -
Picture of Core developers Picture of Plugin developers
That's a bit weird... we have a pile of custom enrol plugins, which use the customX fields, and we never had to implement anything further for back up and restore.

It seemed to all be handled by the enrol_plugin and the backup_enrol_plugin class (backup/controller/)
Average of ratings: Useful (1)
In reply to Michael Hughes

Backup and restore of enrolment plugins

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

Yeh - that's what I was expecting looking at other plugins.

Oh well... more head scratching smile
 
As an aside... the parameters definitely find their way into the backup XML. They just don't restore. 
In reply to Howard Miller

Backup and restore of enrolment plugins

by Gareth Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers
Dear Howard,

Depends how you've implemented the settings. If in 'settings.php' then the data goes in 'config_plugins'. If they are custom user profile fields then I would imagine one of the user tables. Either way I don't think they go anywhere near the backup controller stuff. Would be a site backup and restore thing.

G
In reply to Gareth Barnard

Backup and restore of enrolment plugins

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Hi Gareth,

I have both. The settings.php is site-wide and is fine. I'm talking about the settings in the 'mdl_enrol' table which are created for each instance of an enrolment plugin in a course. When the course is backed up the instance data find its way into the backup file. However, when it's restored, a default instance is created and any changes don't happen.
In reply to Howard Miller

Backup and restore of enrolment plugins

by Gareth Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers
Hi Howard,

I did do a search on 'enrol' in the PHP to try and find where it's referenced for backup purposes but didn't initially find anything.

G
Average of ratings: Useful (1)