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

Using versioned cache (modinfo) during install can fail

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 4.2
    • 4.2
    • Caching, Installation
    • MOODLE_402_STABLE
    • MOODLE_402_STABLE
    • MDL-76784-master
    • Hide

      Perform a Moodle installation successfully.

      The specific get_versioned/set_versioned failure is covered by the new unit test so does not need testing manually, although if you really wanted to, you could do a Moodle installation with latest version of mod_oublog (3rd party plugin) present. (I've done this already, it does work.)

      Show
      Perform a Moodle installation successfully. The specific get_versioned/set_versioned failure is covered by the new unit test so does not need testing manually, although if you really wanted to, you could do a Moodle installation with latest version of mod_oublog (3rd party plugin) present. (I've done this already, it does work.)

      Due to MDL-76129, the 'disabled' cache (used during install) can now use temporary request caches in some cases.

      When used for modinfo cache, the system will try to use the versioned cache API (get_versioned). This API is implemented in all four cache loaders. However it is not implemented directly in cache stores.

      The implementation for disabled cache directly returns cachestore_static without using a loader. As a result, this fails if a third-party plugin tries to do something that requires modinfo during its settings.php, for example. (I know! What idiot would ever do something so crazy! Hmm, who originally wrote mod_oublog...)

      Default exception handler: Exception - Call to undefined method cachestore_static::get_versioned() D
      ebug:
      Error code: generalexceptionmessage
      * line 478 of \lib\modinfolib.php: Error thrown
      * line 441 of \lib\modinfolib.php: call to course_modinfo->__construct()
      * line 2552 of \lib\modinfolib.php: call to course_modinfo::instance()
      * line 589 of \course\lib.php: call to get_fast_modinfo()
      * line 632 of \course\lib.php: call to course_create_sections_if_missing()
      * line 22 of \mod\oublog\settings.php: call to course_add_cm_to_section()
      * line 140 of \lib\classes\plugininfo\mod.php: call to include()
      * line 47 of \admin\settings\plugins.php: call to core\plugininfo\mod->load_settings()
      * line 8927 of \lib\adminlib.php: call to require()
      * line 8959 of \lib\adminlib.php: call to admin_get_root()
      * line 522 of \lib\installlib.php: call to admin_apply_default_settings()
      * line 468 of \lib\phpunit\classes\util.php: call to install_cli_database()
      * line 150 of \admin\tool\phpunit\cli\util.php: call to phpunit_util::install_site()
       
      !!! Exception - Call to undefined method cachestore_static::get_versioned() !!!
      !!
      Error code: generalexceptionmessage !!
      !! Stack trace: * line 478 of \lib\modinfolib.php: Error thrown
      * line 441 of \lib\modinfolib.php: call to course_modinfo->__construct()
      * line 2552 of \lib\modinfolib.php: call to course_modinfo::instance()
      * line 589 of \course\lib.php: call to get_fast_modinfo()
      * line 632 of \course\lib.php: call to course_create_sections_if_missing()
      * line 22 of \mod\oublog\settings.php: call to course_add_cm_to_section()
      * line 140 of \lib\classes\plugininfo\mod.php: call to include()
      * line 47 of \admin\settings\plugins.php: call to core\plugininfo\mod->load_settings()
      * line 8927 of \lib\adminlib.php: call to require()
      * line 8959 of \lib\adminlib.php: call to admin_get_root()
      * line 522 of \lib\installlib.php: call to admin_apply_default_settings()
      * line 468 of \lib\phpunit\classes\util.php: call to install_cli_database()
      * line 150 of \admin\tool\phpunit\cli\util.php: call to phpunit_util::install_site()
       !!
      

      I think this can be fixed just by wrapping the cachestore_static in a cache_request loader. Anyway I'll submit a fix, since this was my fault.

            quen Sam Marshall
            quen Sam Marshall
            Adam Olley Adam Olley
            Ilya Tregubov Ilya Tregubov
            Ron Carl Alfon Yu Ron Carl Alfon Yu
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 21 minutes
                21m

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