Merge branch 'wip-MDL-47812-master2' of git://github.com/marinaglancy/moodle
This commit is contained in:
+18
-23
@@ -32,31 +32,26 @@ defined('MOODLE_INTERNAL') || die();
|
||||
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 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);
|
||||
|
||||
// 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);
|
||||
|
||||
// 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 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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user