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

Wrong rcache invalidation in set_field() function in dmllib.php

XMLWordPrintable

    • Any
    • MOODLE_18_STABLE

      This is the code, responsible for cache invalidation in set_field() function.
      // Clear record_cache based on the parameters passed
      // (individual record or whole table)
      if ($CFG->rcache === true) {
      if ($field1 == 'id')

      { rcache_unset($table, $value1); } else if ($field2 == 'id') { rcache_unset($table, $value1); }

      else if ($field3 == 'id')

      { rcache_unset($table, $value1); } else { rcache_unset_table($table); }
      }


      There are three branches with the same code. Cache must be invalidated using 'id' field value which is $value1 in first branch, $value2 in second one and so on. It should be changed like this, I suppose:
      if ($CFG->rcache === true) {
      if ($field1 == 'id') { rcache_unset($table, $value1); }

      else if ($field2 == 'id')

      { rcache_unset($table, $value2); }

      else if ($field3 == 'id')

      { rcache_unset($table, $value3); }

      else

      { rcache_unset_table($table); }

            stronk7 Eloy Lafuente (stronk7)
            twadd Dionis Zabutilkin (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.