From 9f26a18461a90e7feea83e4f829c70e02c909c8c Mon Sep 17 00:00:00 2001 From: Thomas Dondorf <dondorf@lfi.rwth-aachen.de> Date: Fri, 27 Nov 2020 12:02:18 +0100 Subject: [PATCH] Upgrade script to change customfield added Also the version increased for this to work. --- db/upgrade.php | 13 ++++++++++++- version.php | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/db/upgrade.php b/db/upgrade.php index 3c461d1..cd13857 100644 --- a/db/upgrade.php +++ b/db/upgrade.php @@ -25,7 +25,7 @@ defined('MOODLE_INTERNAL') || die(); function xmldb_local_learning_analytics_upgrade($oldversion) { - global $DB, $CFG; + global $DB, $CFG, $SITE; // Update TOUR to latest version if ($oldversion < 2020101301) { // always update this to the latest version when the usertour was changed @@ -44,5 +44,16 @@ function xmldb_local_learning_analytics_upgrade($oldversion) { upgrade_plugin_savepoint(true, 2020101301, 'local', 'learning_analytics'); } + if ($oldversion < 2020112600 && ($SITE->shortname === 'RWTHmoodle' || $SITE->shortname === 'L2PTest')) { // TODO set version correct + $statussetting = get_config('local_learning_analytics', 'status'); + $customfieldid = (int) get_config('local_learning_analytics', 'customfieldid'); + if ($statussetting === 'course_customfield' && !empty($customfieldid)) { // Update the text in RWTHmoodle + $field = \core_customfield\field_controller::create($customfieldid); + $field->set('name', \local_learning_analytics\settings::CUSTOMFIELD_FIELD_NAME); + $field->set('description', \local_learning_analytics\settings::CUSTOMFIELD_FIELD_DESCRIPTION); + $field->save(); + } + } + return true; } diff --git a/version.php b/version.php index 67f47d4..960a06e 100644 --- a/version.php +++ b/version.php @@ -26,7 +26,7 @@ defined('MOODLE_INTERNAL') || die; $plugin->component = 'local_learning_analytics'; -$plugin->version = 2020102201; +$plugin->version = 2020112600; $plugin->release = 'v0.13.0'; $plugin->maturity = MATURITY_BETA; -- GitLab