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

Problem with moodle/admin/replace.php

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.5
    • Fix Version/s: 1.6
    • Component/s: Administration
    • Labels:
      None
    • Environment:
      All
    • Database:
      Any
    • Affected Branches:
      MOODLE_15_STABLE
    • Fixed Branches:
      MOODLE_16_STABLE

      Description

      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.

        Attachments

          Activity

            People

            Assignee:
            skodak Petr Skoda
            Reporter:
            imported Imported
            Tester:
            Nobody
            Participants:
            Component watchers:
            Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              20/Jun/06