diff --git a/mod/lti/db/upgradelib.php b/mod/lti/db/upgradelib.php index 232d41011b89d..671728e692ee2 100644 --- a/mod/lti/db/upgradelib.php +++ b/mod/lti/db/upgradelib.php @@ -32,31 +32,26 @@ function mod_lti_upgrade_custom_separator() { global $DB; - if ($DB->replace_all_text_supported()) { - - // Initialise parameter array. - $params = array('semicolon' => ';', 'likecr' => "%\r%", 'likelf' => "%\n%", 'lf' => "\n"); - - // Initialise NOT LIKE clauses to check for CR and LF characters. - $notlikecr = $DB->sql_like('value', ':likecr', true, true, true); - $notlikelf = $DB->sql_like('value', ':likelf', true, true, true); - - // Update any instances in the lti_types_config table. - $sql = 'UPDATE {lti_types_config} ' . - 'SET value = REPLACE(value, :semicolon, :lf) ' . - 'WHERE (name = \'customparameters\') AND (' . $notlikecr . ') AND (' . $notlikelf . ')'; - $DB->execute($sql, $params); - - // Initialise NOT LIKE clauses to check for CR and LF characters. - $notlikecr = $DB->sql_like('instructorcustomparameters', ':likecr', true, true, true); - $notlikelf = $DB->sql_like('instructorcustomparameters', ':likelf', true, true, true); - - // Update any instances in the lti table. - $sql = 'UPDATE {lti} ' . - 'SET instructorcustomparameters = REPLACE(instructorcustomparameters, :semicolon, :lf) ' . - 'WHERE (instructorcustomparameters IS NOT NULL) AND (' . $notlikecr . ') AND (' . $notlikelf . ')'; - $DB->execute($sql, $params); - - } - + // Initialise parameter array. + $params = array('semicolon' => ';', 'likecr' => "%\r%", 'likelf' => "%\n%", 'lf' => "\n"); + + // Initialise NOT LIKE clauses to check for CR and LF characters. + $notlikecr = $DB->sql_like('value', ':likecr', true, true, true); + $notlikelf = $DB->sql_like('value', ':likelf', true, true, true); + + // Update any instances in the lti_types_config table. + $sql = 'UPDATE {lti_types_config} ' . + 'SET value = REPLACE(value, :semicolon, :lf) ' . + 'WHERE (name = \'customparameters\') AND (' . $notlikecr . ') AND (' . $notlikelf . ')'; + $DB->execute($sql, $params); + + // Initialise NOT LIKE clauses to check for CR and LF characters. + $notlikecr = $DB->sql_like('instructorcustomparameters', ':likecr', true, true, true); + $notlikelf = $DB->sql_like('instructorcustomparameters', ':likelf', true, true, true); + + // Update any instances in the lti table. + $sql = 'UPDATE {lti} ' . + 'SET instructorcustomparameters = REPLACE(instructorcustomparameters, :semicolon, :lf) ' . + 'WHERE (instructorcustomparameters IS NOT NULL) AND (' . $notlikecr . ') AND (' . $notlikelf . ')'; + $DB->execute($sql, $params); }