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:
Petr Škoda
2013-12-06 09:52:47 +08:00
parent 3e6e38b2e3
commit b4d2e7f267
11 changed files with 245 additions and 49 deletions
+4 -5
View File
@@ -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;
}