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

Tag cache for accessible courses is not invalidated after enrolment or unenrolment

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 3.3, 3.4
    • Fix Version/s: None
    • Component/s: Caching, Enrolments, Tags
    • Labels:
    • Affected Branches:
      MOODLE_33_STABLE, MOODLE_34_STABLE

      Description

      Discovered while testing MDL-46929

      When user is enrolled or unenrolled from the course the tag cache is not invalidated which causes tagged items to be not displayed or displayed. This lasts for up to 15 minutes (cache ttl). Can be resolved by logout and login faster.

      tagindexbuilder is the session cache that should be invalidated when somebody is enrolled/unenrolled but I can't find any invalidation requests in core. They must have been accidentally removed at some point.

      If cache access is removed, everything works without delay:

      diff --git a/tag/classes/index_builder.php b/tag/classes/index_builder.php
      index fe2b5c2..0029bcf 100644
      --- a/tag/classes/index_builder.php
      +++ b/tag/classes/index_builder.php
      @@ -319,7 +319,7 @@ class core_tag_index_builder {
            */
           protected function init_course_access() {
               if ($this->courseaccess === null) {
      -            $this->courseaccess = cache::make('core', 'tagindexbuilder')->get('courseaccess') ?: [];
      +            $this->courseaccess = [];
               }
           }
      

      I will check which stable versions are affected and update

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              marina Marina Glancy
              Participants:
              Component watchers:
              Matteo Scaramuccia, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: