Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lbplanner/db/install.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
* @license https://creativecommons.org/licenses/by-nc-sa/4.0/ CC-BY-NC-SA 4.0 International or later
*/

use local_lbplanner\helpers\config_helper;

use local_lbplanner\helpers\{config_helper, course_helper};

/**
* Runs when plugin is first installed
*/
function xmldb_local_lbplanner_install() {
config_helper::add_customfield();
core_tag_tag::create_if_missing(core_tag_collection::get_default(), [course_helper::EDUPLANNER_TAG], true);
}
12 changes: 12 additions & 0 deletions lbplanner/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,20 @@ function xmldb_local_lbplanner_upgrade($oldversion): bool {
$courseids = $DB->get_fieldset(course_helper::EDUPLANNER_COURSE_TABLE, 'courseid');
$courseids = array_unique($courseids, SORT_REGULAR); // Dedupe.
foreach ($courseids as $courseid) {
try {
get_course($courseid);
} catch (dml_exception) {
/* This means the course doesn't actually exist - meaning it got deleted and not yet cleaned up in the
* DB. normally I would clean it up here, but this upgrade function has to do as little as possible, so
* we can as ensure it actually works as expected under all circumstances. This part of the code is very
* hard to debug and thus uncomfortably fragile.
*/
continue;
}
core_tag_tag::add_item_tag('core', 'course', $courseid, context_course::instance($courseid), $tag->rawname);
}

upgrade_plugin_savepoint(true, 202509060001, 'local', 'lbplanner');
}
return true;
}
Loading