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

Missing cache invalidation of deprecatedcapabilities cache

XMLWordPrintable

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

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

       

       

            Unassigned Unassigned
            franziskah Franziska Hübler
            Votes:
            2 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.