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

Missing cache invalidation of deprecatedcapabilities cache

    XMLWordPrintable

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 4.1, 4.1.1
    • None
    • Roles / Access
    • MOODLE_401_STABLE

    Description

      We run the unit tests for accesslib and all the test connected to get_deprecated_capability failed. Doing some failure research we figured out following problem: In a local plugin we observe the event \core\event\course_created and by doing so cause a capability check.
      Taking as an example the test methode test_get_deprecated_capability_info(): This leads to that after $this->setup_fake_plugin('access') the flag 'deprecated_capabilities_initialised' in the cache ('core', 'deprecatedcapabilities') being already set to true before the intended setup of the test, which should happen in the call of get_deprecated_capability_info('fake/access:fakecapability').

       

      So these unit tests fail because the new deprecated capabilities of the fake_plugin are not in the deprecatedcapabilities cache.

      Maybe function update_capabilities() should note this change. It flushes the cache ('core', 'capabilities') four times:

      cache::make('core', 'capabilities')->delete('core_capabilities');

      but never

      cache::make('core', 'deprecatedcapabilities')->delete('deprecated_capabilities_initialised');

       

       

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              franziskah Franziska Hübler
              David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
              Votes:
              2 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated: