frumbert / wp2moodle-moodle

Moodle end of a Wordpress to Moodle Single Sign On auth plugin
28 stars 29 forks source link

Need to migrate admin settings from config.html to settings.php for Moodle 3.3+ compatibility #34

Open dantabel opened 5 years ago

dantabel commented 5 years ago

The admin settings need to migrated from config.html to settings.php in order to stay compatible with Moodle 3.3+.

From the Moodle 3.3 release notes: "Authentication plugins have been migrated to use the admin settings API. Plugins should use a settings.php file to manage configurations rather than using the old config.html files. See how the helper function upgrade_fix_config_auth_plugin_names() can be used to convert the legacy settings to the new ones. Another helper function upgrade_fix_config_auth_plugin_defaults() can be used to populate the settings with default values so that they are not falsely reported as newly added ones."

All references to get_config('auth/wp2moodle') need changing to get_config('auth_wp2moodle') so they can still be read after the migration.

A database upgrade function also needs creating in db/upgrade.php to convert the existing settings into the new format so that existing settings aren't lost. The methods in the release notes can be used to convert the settings.