Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy default settings to local_recompletion_config on course creation #177

Conversation

aneno-m-e
Copy link

No description provided.

db/upgrade.php Outdated
@@ -987,5 +987,65 @@ function xmldb_local_recompletion_upgrade($oldversion) {
upgrade_plugin_savepoint(true, 2023112600, 'local', 'recompletion');
}

if ($oldversion < 2024071100) {
// We renamed some site admin settings.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we create an array with the list of oldname -> newname and then pass it through a foreach loop that calls the work required for this?

Also - we need to use set_config() - not a sql call to update config_plugins entries because config values are cached. (even if we could use sql, you're missing the "where pluginname = 'recompletion" in the sql :-)

eg

$update = ['choice' => 'choiceattempts', 'customcert' => 'customcertificates''];
foreach ($update as $new -> $old {
    set_config()
}


@aneno-m-e aneno-m-e force-pushed the copy-default-on-course-creation branch from 25b9c39 to 3602088 Compare July 14, 2024 23:39
@aneno-m-e aneno-m-e changed the base branch from MOODLE_401_STABLE to MOODLE_403_STABLE July 14, 2024 23:40
@danmarsden danmarsden merged commit 88b09ae into danmarsden:MOODLE_403_STABLE Jul 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants