MDL-31625 fix multiple global search-replace issues
Includes following fixes: * support for MS SQL Server * optional trimming of of oversized VARCHAR fields * conversion to forms library * full localisation * other cleanup
This commit is contained in:
+4
-5
@@ -6741,11 +6741,8 @@ function db_replace($search, $replace) {
|
||||
|
||||
if ($columns = $DB->get_columns($table)) {
|
||||
$DB->set_debug(true);
|
||||
foreach ($columns as $column => $data) {
|
||||
if (in_array($data->meta_type, array('C', 'X'))) { // Text stuff only
|
||||
//TODO: this should be definitively moved to DML driver to do the actual replace, this is not going to work for MSSQL and Oracle...
|
||||
$DB->execute("UPDATE {".$table."} SET $column = REPLACE($column, ?, ?)", array($search, $replace));
|
||||
}
|
||||
foreach ($columns as $column) {
|
||||
$DB->replace_all_text($table, $column, $search, $replace);
|
||||
}
|
||||
$DB->set_debug(false);
|
||||
}
|
||||
@@ -6776,6 +6773,8 @@ function db_replace($search, $replace) {
|
||||
echo $OUTPUT->notification("...finished", 'notifysuccess');
|
||||
}
|
||||
|
||||
purge_all_caches();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user