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

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

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Duplicate
    • 1.8.4
    • None
    • None
    • Any
    • MOODLE_18_STABLE

    Description

      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); }

      Attachments

        Issue Links

          Activity

            People

              stronk7 Eloy Lafuente (stronk7)
              twadd Dionis Zabutilkin
              Nobody Nobody
              Amaia Anabitarte, Bas Brands, Carlos Escobedo, Laurent David, Raquel Ortega, Sabina Abellan, Sara Arjona (@sarjona), David Woloszyn, Huong Nguyen, Jake Dallimore, Michael Hawkins, Stevani Andolo
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: