Skip to content

Commit

Permalink
MDL-75738 tool_moodlenet: Upgrade clean user profile slow, pointless
Browse files Browse the repository at this point in the history
There is an upgrade to clean the moodlenetprofile field which
performs very poorly, but it is also not needed because an upgrade
further down sets this field to empty string anyway.
  • Loading branch information
sammarshallou committed Sep 26, 2022
1 parent 8f492a8 commit 5afc441
Showing 1 changed file with 0 additions and 18 deletions.
18 changes: 0 additions & 18 deletions admin/tool/moodlenet/db/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,24 +105,6 @@ function xmldb_tool_moodlenet_upgrade(int $oldversion) {
// Automatically generated Moodle v3.9.0 release upgrade line.
// Put any upgrade step following this.

if ($oldversion < 2021052501) {

// Find out if there are users with MoodleNet profiles set.
$sql = "SELECT u.*
FROM {user} u
WHERE u.moodlenetprofile IS NOT NULL";

$records = $DB->get_records_sql($sql);

foreach ($records as $record) {
// Force clean user value just incase there is something malicious.
$record->moodlenetprofile = clean_text($record->moodlenetprofile, PARAM_NOTAGS);
$DB->update_record('user', $record);
}

upgrade_plugin_savepoint(true, 2021052501, 'tool', 'moodlenet');
}

if ($oldversion < 2022021600) {
// This is a special case for if MoodleNet integration has never been enabled,
// or if defaultmoodlenet is not set for whatever reason.
Expand Down

0 comments on commit 5afc441

Please sign in to comment.