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

Allow alternate muc cache config class (eg allow setup in pure $CFG / config.php)

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Setup

      1. Install the PHP APCu extension. e.g. on Ubuntu/LinuxMint

        sudo apt install php-apcu
        

      2. Restart the web server. e.g.

        sudo service apache2 restart
        

      3. Confirm that the APCu extension has been successfully installed by checking it in [YOUR_MOODLE_URL]/admin/phpinfo.php.
         

      Testing Instructions

      This patch is a major refactor of the caching admin page. The first section will cover existing functionality and ensuring it is consistent.

      Step 1: Installed cache stores
      1. Visit /cache/admin.php
      2. In the list of installed cache stores, ensure 'APC user cache (APCu)' is ready
      3. Click on the 'Add Instance' Link in the APCu actions column
      4. Call the store 'apcutest' and click Save Changes.
      5. Verify that in the configured store instances table, there is an 'apcutest' row.
      6. Now click 'Add Instance' in the File cache actions column.
      7. Call the store 'filetest' and click Save Changes.
      8. Verify that in the configured store instances table, there is a 'filetest' row.
      Step 2: Configured store instances
      1. While still on the cache/admin.php page, click  'Edit store'  in the apcutest row of the configured store instances table.
      2. Verify that the name and prefix are the same as from the above step.
      3. Edit the prefix to mdl_1 and click save changes.
      4. Edit the same store instance again.
      5. Verify that the prefix was edited to mdl_1.
      6. Click Cancel to return to the previous page.
      7. Click 'Delete store' on the filetest row.
      8. Confirm the deletion, and verify that there is a notification on the page with the text: 'Successfully deleted the cache store'
      9. Verify there is no longer a filetest row in the configured store instances table.
      10. Click 'Purge' on the apcutest row.
      11. Verify there is a notification on the page with the text: 'Successfully purged the "apcutest" store. Purge again'
      Step 3: Known cache definitions
      1. Find the coursemodinfo row in the known cache definitions.
      2. Click 'Edit mappings', and set Primary to be 'apcutest' and Secondary to 'Default_application', then save changes.
      3. Verify the store mappings for the coursemodinfo now shows apcutest, default files.
      4. Click 'Edit sharing', and select the Custom key option, then enter the key 'test' and save changes.
      5. Click the same button, and verify the changes were successfully saved, the press 'Cancel'
      6. Now click 'Purge' on coursemodinfo and verify that there is a notification on the page with the text: 'Successfully purged the "Accumulated information about modules and sections for each course" cache (core/coursemodinfo). Purge again'.
      7. At the bottom of the known cache definitions table, click the 'Rescan definitions' link.
      8. Verify that the page reloads.
      Step 4: Summary of cache lock instances
      1. Click on the select underneath the table, and select 'File Locking'.
      2. Call this lock 'locktest', and save changes.
      3. Verify there is a notification on the page with the text: ' Successfully added a new lock instance.'
      4. Verify there is a 'locktest' row in the lock summary table.
      5. Click the 'Delete' action in the locktest row and confirm the delete.
      6. Verify there is a notification on the page with the text: ' Successfully deleted the lock.'
      7. Verify 'locktest' is no longer in the lock table.
      Step 5: Stores used when no mapping is present
      1. Verify that the stores used when no mapping is present are all the default stores.
      2. Click 'Edit mappings' underneath the table.
      3. Set the application default to 'apcutest', then save changes.
      4. Verify that the Application default cache is now apcutest in the table.
      5. Verify that there is a warning icon next to apcutest in the table.
      6. Verify that the application caches in the definitions table have apcutest as the default caching now.

      Now that we have verified that the frontend is unchanged by the backend refactor, we will need to test the swapping out capability.

      Step 6: Clone and install a custom caching config plugin.
      1. From the main moodle directory open a terminal, and run:

        git clone https://github.com/catalyst/moodle-tool_forcedcache.git admin/tool/forcedcache

      2. Now visit /admin/index.php and run the upgrade to install the plugin.
      3. Edit config.php, and add this line:

        $CFG->alternative_cache_factory_class = 'tool_forcedcache_cache_factory';
        

      4. Visit cache/admin.php
      5. Verify that there are no actions available in the installed cache stores table.
      6. Verify that there are 2 configured stores in configured store instances, 'apcu1' and 'file1'.
      7. Verify the only actions available for configured store instances is 'Purge'.
      8. Verify that the only action available action in the known cache definitions table is 'Purge' on all of the definitions.
      9. Verify that the summary of cache lock instances no longer contains a select underneath it.
      10. Verify that at the bottom of the page there is a custom set of tables, showing Caching Rules.
      11. This shows that a custom caching config is in place and working and that the GUI definition has been overridden by a custom tool.
      Show
      Setup Install the PHP APCu extension. e.g. on Ubuntu/LinuxMint sudo apt install php-apcu Restart the web server. e.g. sudo service apache2 restart Confirm that the APCu extension has been successfully installed by checking it in [YOUR_MOODLE_URL] /admin/phpinfo.php .   Testing Instructions This patch is a major refactor of the caching admin page. The first section will cover existing functionality and ensuring it is consistent. Step 1: Installed cache stores Visit /cache/admin.php In the list of installed cache stores, ensure 'APC user cache (APCu)' is ready Click on the 'Add Instance' Link in the APCu actions column Call the store 'apcutest' and click Save Changes. Verify that in the configured store instances table, there is an 'apcutest' row. Now click 'Add Instance' in the File cache actions column. Call the store 'filetest' and click Save Changes. Verify that in the configured store instances table, there is a 'filetest' row. Step 2: Configured store instances While still on the cache/admin.php page, click  'Edit store'  in the apcutest row of the configured store instances table. Verify that the name and prefix are the same as from the above step. Edit the prefix to mdl_1 and click save changes. Edit the same store instance again. Verify that the prefix was edited to mdl_1. Click Cancel to return to the previous page. Click 'Delete store' on the filetest row. Confirm the deletion, and verify that there is a notification on the page with the text: 'Successfully deleted the cache store' Verify there is no longer a filetest row in the configured store instances table. Click 'Purge' on the apcutest row. Verify there is a notification on the page with the text: 'Successfully purged the "apcutest" store. Purge again' Step 3: Known cache definitions Find the coursemodinfo row in the known cache definitions. Click 'Edit mappings', and set Primary to be 'apcutest' and Secondary to 'Default_application', then save changes. Verify the store mappings for the coursemodinfo now shows apcutest, default files. Click 'Edit sharing', and select the Custom key option, then enter the key 'test' and save changes. Click the same button, and verify the changes were successfully saved, the press 'Cancel' Now click 'Purge' on coursemodinfo and verify that there is a notification on the page with the text: 'Successfully purged the "Accumulated information about modules and sections for each course" cache (core/coursemodinfo). Purge again'. At the bottom of the known cache definitions table, click the 'Rescan definitions' link. Verify that the page reloads. Step 4: Summary of cache lock instances Click on the select underneath the table, and select 'File Locking'. Call this lock 'locktest', and save changes. Verify there is a notification on the page with the text: ' Successfully added a new lock instance.' Verify there is a 'locktest' row in the lock summary table. Click the 'Delete' action in the locktest row and confirm the delete. Verify there is a notification on the page with the text: ' Successfully deleted the lock.' Verify 'locktest' is no longer in the lock table. Step 5: Stores used when no mapping is present Verify that the stores used when no mapping is present are all the default stores. Click 'Edit mappings' underneath the table. Set the application default to 'apcutest', then save changes. Verify that the Application default cache is now apcutest in the table. Verify that there is a warning icon next to apcutest in the table. Verify that the application caches in the definitions table have apcutest as the default caching now. Now that we have verified that the frontend is unchanged by the backend refactor, we will need to test the swapping out capability. Step 6: Clone and install a custom caching config plugin. From the main moodle directory open a terminal, and run: git clone https: //github.com/catalyst/moodle-tool_forcedcache.git admin/tool/forcedcache Now visit /admin/index.php and run the upgrade to install the plugin. Edit config.php, and add this line: $CFG->alternative_cache_factory_class = 'tool_forcedcache_cache_factory' ; Visit cache/admin.php Verify that there are no actions available in the installed cache stores table. Verify that there are 2 configured stores in configured store instances, 'apcu1' and 'file1'. Verify the only actions available for configured store instances is 'Purge'. Verify that the only action available action in the known cache definitions table is 'Purge' on all of the definitions. Verify that the summary of cache lock instances no longer contains a select underneath it. Verify that at the bottom of the page there is a custom set of tables, showing Caching Rules. This shows that a custom caching config is in place and working and that the GUI definition has been overridden by a custom tool.
    • Affected Branches:
      MOODLE_25_STABLE, MOODLE_31_STABLE, MOODLE_38_STABLE
    • Pull 3.10 Branch:
      MDL-41492-310
    • Pull Master Branch:
      MDL-41492-master

      Description

      We have plenty of Moodle sites and configuring MUC to each one via Moodle UI is not possible. It should be possible to configure MUC via CLI and/or with CFG variables.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              peterburnett Peter Burnett
              Reporter:
              modguru Jai Gupta
              Peer reviewer:
              Brendan Heywood
              Integrator:
              Jun Pataleta
              Participants:
              Component watchers:
              Matteo Scaramuccia, Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona)
              Votes:
              14 Vote for this issue
              Watchers:
              26 Start watching this issue

                Dates

                Created:
                Updated: