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

Fix aggressive cache rebuilding in mod_lti and user profile

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Please either generate 10,000 courses or restore a database that may have that amount or more.

      Testing /mod/lti/locallib.php,
      Navigate to /admin/settings.php?section=modsettinglti
      Select the option to 'Add external tool configuration'
      Fill the required settings 'Tool Name' and 'Tool base URL' with basic values such as Test and 'http://www.google.com'. Since we're not testing the external tool itself this field can be anything.
      Check the box for 'Show tool type when creating tool instances'.
      Do not configure the Icon URL settings yet.
      Save the changes.

      Navigate to a course that you can edit. /course/view.php?id=2
      Click on 'Turn editing on'.
      Click on 'Add an activity or resource'.
      In the list of Activities select 'External Tool', click add.

      You should now be viewing the 'Adding a new External tool settings'.
      Type in 'Test' as the activity name.
      Select the 'Test' tool from the dropdown selection in External tool type.
      Click save and return to course.

      Navigate back to /admin/settings.php?section=modsettinglti
      Edit the Test tool that you created earlier
      Click on 'Show More' to make the Icon URL settings visible.
      Set Icon URL to http://www.google.com/favicon.ico
      Set Secure icon URL to https://www.google.com/favicon.ico
      Save the changes.

      Navigate back to a test course that you edited. /course/view.php?id=2
      The icon should now be different.
      It has now bypassed regenerating the cache of those 10,000 courses.

      Testing user/profile/definelib.php,
      Navigate to /user/profile/index.php
      Click on the drop down selection box beneath 'Create a new profile field:' and select 'Text Input'.
      Enter 'test' in the required fields shortname and name and save the changes.
      On the /user/profile/index.php page, click on the delete button for the new profile field created.
      It has now bypassed regenerating the cache of those 10,000 courses.

      Testing admin/tool/multilangupgrade/index.php,
      Navigate to /admin/tool/multilangupgrade/index.php
      Click on 'Continue' to initiate the process.
      It has now bypassed regenerating the cache of those 10,000 courses.

      Show
      Please either generate 10,000 courses or restore a database that may have that amount or more. Testing /mod/lti/locallib.php, Navigate to /admin/settings.php?section=modsettinglti Select the option to 'Add external tool configuration' Fill the required settings 'Tool Name' and 'Tool base URL' with basic values such as Test and 'http://www.google.com'. Since we're not testing the external tool itself this field can be anything. Check the box for 'Show tool type when creating tool instances'. Do not configure the Icon URL settings yet. Save the changes. Navigate to a course that you can edit. /course/view.php?id=2 Click on 'Turn editing on'. Click on 'Add an activity or resource'. In the list of Activities select 'External Tool', click add. You should now be viewing the 'Adding a new External tool settings'. Type in 'Test' as the activity name. Select the 'Test' tool from the dropdown selection in External tool type. Click save and return to course. Navigate back to /admin/settings.php?section=modsettinglti Edit the Test tool that you created earlier Click on 'Show More' to make the Icon URL settings visible. Set Icon URL to http://www.google.com/favicon.ico Set Secure icon URL to https://www.google.com/favicon.ico Save the changes. Navigate back to a test course that you edited. /course/view.php?id=2 The icon should now be different. It has now bypassed regenerating the cache of those 10,000 courses. Testing user/profile/definelib.php, Navigate to /user/profile/index.php Click on the drop down selection box beneath 'Create a new profile field:' and select 'Text Input'. Enter 'test' in the required fields shortname and name and save the changes. On the /user/profile/index.php page, click on the delete button for the new profile field created. It has now bypassed regenerating the cache of those 10,000 courses. Testing admin/tool/multilangupgrade/index.php, Navigate to /admin/tool/multilangupgrade/index.php Click on 'Continue' to initiate the process. It has now bypassed regenerating the cache of those 10,000 courses.
    • Affected Branches:
      MOODLE_29_STABLE, MOODLE_30_STABLE, MOODLE_31_STABLE
    • Fixed Branches:
      MOODLE_30_STABLE, MOODLE_31_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-53788_modlti_master

      Description

      External tool types can be configured at admin/settings.php?section=modsettinglti

      When saving an icon URL in a external tool type, Moodle will aggressively rebuild the course_modinfo::build_course_cache($course); for every course that exists.

      This does not scale on large production sites at all and leads to the user that updated the icon URL to experience a timeout of up to and over 10 minutes depending on the configuration and number of courses (20k+). Also rebuilding the course cache is not something that you want to run on a live production site when someone changes a URL.

      This patch will only rebuild the course cache for the courses that implement one of these external tool types when the icon URL is modified.

        Attachments

          Activity

            People

            • Votes:
              1 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                11/Jul/16