-
Bug
-
Resolution: Fixed
-
Minor
-
1.5
-
None
-
All
-
Any
-
MOODLE_15_STABLE
-
MOODLE_16_STABLE
When you try to use this to fix something in your Moodle site tables, it might create a problem.
The link tried to replace all items in every table in the database. The problem comes if you have other tables in that database which might not be related to Moodle and need not be updated from the url moodle/admin/replace.php
Here is my fix to this problem:
=====================
$myPrefix = $CFG->prefix;
foreach ($tables as $table) {
if (in_array($table, array($CFG->prefix.'config')))
{ // Don't process these $yesno = ==> No; continue; }if (!(eregi(^$myPrefix, $table)))
{ continue; }
/* echo $table . $yesno . <br />;
continue; */
if ($columns = $db->MetaColumns($table, false)) {
foreach ($columns as $column => $data) {
if (in_array($data->type, array('text','mediumtext','longtext','varchar')))
{ // Text stuff only $db->debug = true; execute_sql(UPDATE $table SET $column = REPLACE($column, '$search', '$replace');); $db->debug = false; }}
}
}
Let me know when this is fix.