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

Deleting a course doesn't purge caches

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Deferred
    • Affects Version/s: 2.6
    • Fix Version/s: None
    • Component/s: Caching
    • Labels:

      Description

      While reviewing MDL-42301 I noticed the following error when I deleted a course from the course management interface

      Stack trace:
       
          line 393 of /lib/setuplib.php: coding_exception thrown
          line 2639 of /lib/coursecatlib.php: call to default_error_handler()
          line 1434 of /lib/coursecatlib.php: call to course_in_list->__construct()
          line 451 of /course/classes/management_renderer.php: call to coursecat->get_courses()
          line 421 of /course/management.php: call to core_course_management_renderer->course_listing()
      

      The reason for the error was get_courses was returning an outdated list of courses. However during the course delete process fix_course_sortorder() is called , which is supposed to purge the related caches, but that is not what is happening. For some reason the caches are not purged and hence the error is generated.
      I tried using cache_helper::purge_by_event('changesincoursecat'); and the error still persists, however if I purge the catch by definition for 'coursecat' in delete_course() , everything works as expected.

      This is an edge case scenario , I am able to reproduce this only in one of my Moodle installs. All other installs work as expected. I do not have any noticeable difference in settings between the installs, hence am not exactly sure how to replicate it on a fresh install.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              samhemelryk Sam Hemelryk
              Reporter:
              ankit_frenz Ankit Agarwal
              Participants:
              Component watchers:
              Matteo Scaramuccia, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: