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

Provide more granular purging of caches

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.4.1, 3.5, 3.6
    • Fix Version/s: 3.6
    • Component/s: Caching
    • Labels:
    • Testing Instructions:
      Hide

      Web interface

      • Visit admin/purgecaches.php
      • Edit theme/boost/scss/moodle/core.scss, add the following at the bottom:
        • body {background-color: pink !important}
      • Edit lang/en/admin.php, and change the string 'purgecachespage' to:
        • 'Purge caches 1'
      • Reload the page
        • The background colour should not change, the title should read "Purge caches"
      • Click "Purge all caches"
        • You should see the message "All caches were purged"
        • The title should say "Purge caches 1"
      • Wait 1 minute and reload the page
        • The background colour should be pink.
      • Change the CSS from "pink" to "red", and the language string from "1" to "2"
      • Tick the "Language strings" check box and click "Purge selected caches"You should see the message
        • "Selected caches were purged"The title should read "Purge caches 2"
      • Wait 1 minute and reload the page
        • The background colour should still be pink.
      • Change the language string from "2" to "3"
      • Tick the "Themes" checkbox and click "Purge selected caches"
      • Wait 1 minute and reload the page
        • The title should still be "Purge caches 2"
        • The background colour should be red
      • Remove the new CSS rule and remove the number from the language string
      • Tick both "Themes" and "Language Strings", and press "Purge selected caches"
        • The title should be "Purge caches"
      • Wait 1 minute and reload the page
        • The background colour should be back to normal
      • Visit admin/purgecaches.php?returnurl=/course/index.php
      • Use either button to purge some caches
        • You should be returned to /course/index.php

      Command-line interface

      • Load a moodle page in the browser.
      • Edit theme/boost/scss/moodle/core.scss, add the following at the bottom:
        • body {background-color: pink !important}
      • Edit lang/en/admin.php, and change the string 'purgecachespage' to:
        • 'Purge caches 1'
      • Reload the page
        • The background colour should not change, the title should read "Purge caches"
      • Run php admin/cli/purge_caches.php
      • Wait 1 minute and reload the page
        • The title should say "Purge caches 1"
        • The background colour should be pink.
      • Change the CSS from "pink" to "red", and the language string from "1" to "2"
      • Run php admin/cli/purge_caches.php --lang
      • Wait 1 minute and reload the page
        • The title should read "Purge caches 2"
        • The background colour should still be pink.
      • Change the language string from "2" to "3"
      • Run php admin/cli/purge_caches.php --theme
      • Wait 1 minute and reload the page
        • The title should still be "Purge caches 2"
        • The background colour should be red
      • Remove the new CSS rule and remove the number from the language string
      • Run php admin/cli/purge_caches.php --lang --theme
      • Wait 1 minute and reload the page
        • The title should be "Purge caches"
        • The background colour should be back to normal
      • Run php admin/cli/purge_caches.php --all --muc
        • You should get an error message about an invalid combination of options.

      "Purge all caches" footer links

      • Go to any page other than the "Purge caches" page
      • Click the "Purge all caches" link in the footer
        • You should return back to the same page
        • You should see the "All caches were purged" message

      Site administration link

      • Click the "Site administration" link
      • Select the "Development" tab
      • The link to purgecaches.php should read "Purge caches", previously it read "Purge all caches"
      Show
      Web interface Visit admin/purgecaches.php Edit theme/boost/scss/moodle/core.scss , add the following at the bottom: body {background-color: pink !important } Edit lang/en/admin.php , and change the string 'purgecachespage' to: 'Purge caches 1' Reload the page The background colour should not change, the title should read "Purge caches" Click "Purge all caches" You should see the message "All caches were purged" The title should say "Purge caches 1" Wait 1 minute and reload the page The background colour should be pink. Change the CSS from "pink" to "red", and the language string from "1" to "2" Tick the "Language strings" check box and click "Purge selected caches"You should see the message "Selected caches were purged"The title should read "Purge caches 2" Wait 1 minute and reload the page The background colour should still be pink. Change the language string from "2" to "3" Tick the "Themes" checkbox and click "Purge selected caches" Wait 1 minute and reload the page The title should still be "Purge caches 2" The background colour should be red Remove the new CSS rule and remove the number from the language string Tick both "Themes" and "Language Strings", and press "Purge selected caches" The title should be "Purge caches" Wait 1 minute and reload the page The background colour should be back to normal Visit admin/purgecaches.php?returnurl=/course/index.php Use either button to purge some caches You should be returned to /course/index.php Command-line interface Load a moodle page in the browser. Edit theme/boost/scss/moodle/core.scss , add the following at the bottom: body {background-color: pink !important } Edit lang/en/admin.php , and change the string 'purgecachespage' to: 'Purge caches 1' Reload the page The background colour should not change, the title should read "Purge caches" Run php admin/cli/purge_caches.php Wait 1 minute and reload the page The title should say "Purge caches 1" The background colour should be pink. Change the CSS from "pink" to "red", and the language string from "1" to "2" Run php admin/cli/purge_caches.php --lang Wait 1 minute and reload the page The title should read "Purge caches 2" The background colour should still be pink. Change the language string from "2" to "3" Run php admin/cli/purge_caches.php --theme Wait 1 minute and reload the page The title should still be "Purge caches 2" The background colour should be red Remove the new CSS rule and remove the number from the language string Run php admin/cli/purge_caches.php --lang --theme Wait 1 minute and reload the page The title should be "Purge caches" The background colour should be back to normal Run php admin/cli/purge_caches.php --all --muc You should get an error message about an invalid combination of options. "Purge all caches" footer links Go to any page other than the "Purge caches" page Click the "Purge all caches" link in the footer You should return back to the same page You should see the "All caches were purged" message Site administration link Click the "Site administration" link Select the "Development" tab The link to purgecaches.php should read "Purge caches", previously it read "Purge all caches"
    • Affected Branches:
      MOODLE_34_STABLE, MOODLE_35_STABLE, MOODLE_36_STABLE
    • Fixed Branches:
      MOODLE_36_STABLE
    • Pull Master Branch:
      MDL-61244_master

      Description

      Following on from a discussion in Moodle developer chat, it would be nice if it were possible to invalidate parts of Moodle's cache, rather than simply all.

      Currently the MUC allows invalidation of parts of the cache, but other caches such as Theme, Javascript, and language strings are not part of this.

      Theme, Javascript & Language strings can only be purged via the Purge All Caches, which is a bit brutal, especially where MUC caches may not need invalidation.

      Options to:

      1. Purge All
      2. Purge MUC
      3. Purge All Non-MUC Caches (Theme & Javascript & Language)
      4. Purge Theme
      5. Purge Javascript
      6. Purge Language Strings

      on the purge cache page / scripts would allow admins & developers to purge only specific areas.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                5 Vote for this issue
                Watchers:
                11 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  3/Dec/18