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

Caching of templates should use a new templaterev variable

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      Test 1
      1. Log in as an admin.
      2. Visit 'Site administration' > 'Appearance' > 'Templates'.
      3. Ensure that 'Cache Templates' is checked.
      4. Visit a course.
      5. Create a forum.
      6. Add a discussion.
      7. View the discussion.
      8. Click 'Reply' and notice an in-page reply form appears.
      9. Notice that it says 'Reply privately' next to the checkbox
      10. Make a change to mod/forum/templates/inpage_reply.mustache by replacing

        {{#str}} privatereply, forum {{/str}}

        with "I want this to be private, please".

      11. Refresh the page.
      12. Click 'Reply' and notice an in-page reply form appears.
      13. Confirm it still says 'Reply privately' next to the checkbox.
      14. Visit 'Site administration' > 'Development' > 'Purge caches'.
      15. Check the box next to 'Templates'
      16. Click 'Purge selected caches'.
      17. Go back to the forum discussion you were at earlier.
      18. Click 'Reply'.
      19. Confirm you see the string "I want this to be private, please" next to the checkbox.
      Test 2
      1. Log in as an admin.
      2. Visit 'Site administration' > 'Appearance' > 'Templates'
      3. Uncheck 'Cache Templates' and press 'Save changes'.
      4. Visit a course.
      5. Create a forum.
      6. Add a discussion.
      7. View the discussion.
      8. Click 'Reply' and notice an in-page reply form appears.
      9. Notice that it says 'Reply privately' next to the checkbox.
      10. Make a change to mod/forum/templates/inpage_reply.mustache by replacing

        {{#str}} privatereply, forum {{/str}}

        with "I want this to be private, please".

      11. Refresh the page.
      12. Click 'Reply' and notice an in-page reply form appears.
      13. Confirm that it says "I want this to be private, please" next to the checkbox.
      Test 3
      1. Log in as an admin.
      2. Visit 'Site administration' > 'Appearance' > 'Templates'.
      3. Ensure that 'Cache Templates' is checked.
      4. Visit a course.
      5. Create a forum.
      6. Add a discussion.
      7. View the discussion.
      8. Click 'Reply' and notice an in-page reply form appears.
      9. Notice that it says 'Reply privately' next to the checkbox
      10. Make a change to mod/forum/templates/inpage_reply.mustache by replacing

        {{#str}} privatereply, forum {{/str}}

        with "I want this to be private, please".

      11. Refresh the page.
      12. Click 'Reply' and notice an in-page reply form appears.
      13. Confirm it still says 'Reply privately' next to the checkbox.
      14. Visit 'Site administration' > 'Development' > 'Purge caches'.
      15. Check the box next to 'JavaScript'
      16. Click 'Purge selected caches'.
      17. Go back to the forum discussion you were at earlier.
      18. Click 'Reply'.
      19. Confirm it still says 'Reply privately' next to the checkbox.
      Show
      Test 1 Log in as an admin. Visit 'Site administration' > 'Appearance' > 'Templates'. Ensure that 'Cache Templates' is checked. Visit a course. Create a forum. Add a discussion. View the discussion. Click 'Reply' and notice an in-page reply form appears. Notice that it says 'Reply privately' next to the checkbox Make a change to mod/forum/templates/inpage_reply.mustache by replacing {{#str}} privatereply, forum {{/str}} with "I want this to be private, please". Refresh the page. Click 'Reply' and notice an in-page reply form appears. Confirm it still says 'Reply privately' next to the checkbox. Visit 'Site administration' > 'Development' > 'Purge caches'. Check the box next to 'Templates' Click 'Purge selected caches'. Go back to the forum discussion you were at earlier. Click 'Reply'. Confirm you see the string "I want this to be private, please" next to the checkbox. Test 2 Log in as an admin. Visit 'Site administration' > 'Appearance' > 'Templates' Uncheck 'Cache Templates' and press 'Save changes'. Visit a course. Create a forum. Add a discussion. View the discussion. Click 'Reply' and notice an in-page reply form appears. Notice that it says 'Reply privately' next to the checkbox. Make a change to mod/forum/templates/inpage_reply.mustache by replacing {{#str}} privatereply, forum {{/str}} with "I want this to be private, please". Refresh the page. Click 'Reply' and notice an in-page reply form appears. Confirm that it says "I want this to be private, please" next to the checkbox. Test 3 Log in as an admin. Visit 'Site administration' > 'Appearance' > 'Templates'. Ensure that 'Cache Templates' is checked. Visit a course. Create a forum. Add a discussion. View the discussion. Click 'Reply' and notice an in-page reply form appears. Notice that it says 'Reply privately' next to the checkbox Make a change to mod/forum/templates/inpage_reply.mustache by replacing {{#str}} privatereply, forum {{/str}} with "I want this to be private, please". Refresh the page. Click 'Reply' and notice an in-page reply form appears. Confirm it still says 'Reply privately' next to the checkbox. Visit 'Site administration' > 'Development' > 'Purge caches'. Check the box next to 'JavaScript' Click 'Purge selected caches'. Go back to the forum discussion you were at earlier. Click 'Reply'. Confirm it still says 'Reply privately' next to the checkbox.
    • Affected Branches:
      MOODLE_38_STABLE
    • Fixed Branches:
      MOODLE_38_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-66367_master

      Description

      Right now the template caching introduced in MDL-65794 makes use of $CFG->themerev. This means that when I am developing templates, I have to constantly purge my caches or use theme designer mode.
      When theme designer mode is enabled the SCSS is recompiled on each page load which can easily take several seconds and really damages the developer experience.

      We should create a new templaterev variable and use that instead.
      I would recommend modelling it on cachejs and jsrev.

      That is to say:

      1. a $CFG->cachetemplates setting; and
      2. A templaterev counter

      When cachetemplates is empty or true, then the currently stored templaterev is used (from config)
      When cachetemplates is false, templaterev is -1.

      I'm going to set priority of this issue to blocker because it makes working on templates painfully slow.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                markn Mark Nelson
                Reporter:
                dobedobedoh Andrew Nicols
                Peer reviewer:
                Andrew Nicols
                Integrator:
                Jake Dallimore
                Tester:
                Jennifer Bauzon
                Participants:
                Component watchers:
                Matteo Scaramuccia, Jake Dallimore, Jun Pataleta, Ryan Wyllie, Amaia Anabitarte, Bas Brands, Carlos Escobedo, Sara Arjona (@sarjona), Víctor Déniz Falcón
              • Votes:
                3 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  11/Nov/19

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 hour
                  1h