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

Navigation block: Unnecessary cache can cause deleted activities to remain listed

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 2.1.5, 2.2.2, 2.3
    • Fix Version/s: 2.1.6, 2.2.3
    • Component/s: Navigation
    • Labels:
    • Testing Instructions:
      Hide

      You will need a course that has one section containing multiple activities. I'm referring to these as A and B. For example, on qa.moodle.net you could use the 'Upload a single file' and 'Offline activity' activities.

      1. In one browser, log in as student and go to Activity A.
      + Note that Activity B is shown in the navigation menu.
      2. In another browser, log in as manager and delete Activity B.
      3. Back in the student's browser, hit Reload.

      Expected result:

      • Activity B is no longer shown in the navigation.

      Actual result:

      • Activity B remains in the navigation. Clicking it gives an 'Invalid course module ID' error.
      Show
      You will need a course that has one section containing multiple activities. I'm referring to these as A and B. For example, on qa.moodle.net you could use the 'Upload a single file' and 'Offline activity' activities. 1. In one browser, log in as student and go to Activity A. + Note that Activity B is shown in the navigation menu. 2. In another browser, log in as manager and delete Activity B. 3. Back in the student's browser, hit Reload. Expected result: Activity B is no longer shown in the navigation. Actual result: Activity B remains in the navigation. Clicking it gives an 'Invalid course module ID' error.
    • Workaround:
      Hide

      Wait ten minutes or so, then it sorts itself out.

      Show
      Wait ten minutes or so, then it sorts itself out.
    • Affected Branches:
      MOODLE_21_STABLE, MOODLE_22_STABLE, MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_21_STABLE, MOODLE_22_STABLE
    • Pull Master Branch:
      wip-MDL-31631-m23

      Description

      The navigation block caches data about course activities in the user session. This is bad for two reasons:

      1. It causes unexpected results if a teacher creates or deletes an activity while students are using the site (for some minutes, the deleted activity link will still be available but give an error).

      2. This information is already cached in modinfo.

      As modinfo can be obtained free-of-charge in most requests, this means that this part of the cache is unnecessary and is wasting user session space. If the course has hundreds of activities, it might be a moderate proportion of session space.

      There are probably other aspects of the navigation block that are not cached in modinfo and therefore it is convenient to cache the whole thing even the bit that is not necessary, but I think somebody should at least consider this; it might be possible to avoid storing the part that comes from modinfo in cache.

      Note: I'm not certain all the necessary data about sessions is in modinfo. But if it isn't, it totally ought to be.

      The consequences of this bug are not very serious so unfortunately I don't have time to code it at the moment, I guess maybe other people will also not have time, but, thought it was worth filing it after testing staff here reported the problem.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Votes:
                  2 Vote for this issue
                  Watchers:
                  4 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Fix Release Date:
                    14/May/12