Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-3235

Problem with moodle/admin/replace.php

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 1.6
    • 1.5
    • Administration
    • 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.

            skodak Petr Skoda
            imported Imported (Inactive)
            Nobody Nobody (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.