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

Provide a way to pre-compile all site themes during CLI upgrade and install

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.4
    • Fix Version/s: 3.4
    • Component/s: Themes
    • Labels:
    • Testing Instructions:
      Hide

      Test 1 - new install w/ database

      1. Checkout a new moodle instance but don’t install it via the web UI
      2. Install moodle using the CLI installer admin/cli/install.php
      3. Check the task_adhoc table in your database and confirm that a \core\task\build_installed_themes_task task has been queued
      4. Check your local cache and confirm that a CSS file was generated for the default theme
        • The default theme should be Boost
        • The default local cache directory is in a sibling directory to your moodle install called moodledata. The CSS should be in moodledata/localcache/theme/<revision>/boost/css/all_<subrevision>.css
      5. Note down both the <revision> and <subrevision> numbers for the file in the local cache
      6. Open the dev tools in your browser and go to the network tab and filter for CSS requests
      7. Navigate to your new Moodle install
      8. Check the network tab and confirm the “all” stylesheet was loaded from the local cache (you can tell because the time to load will be in the milliseconds instead of seconds)
      9. Run cron
      10. Confirm that the adhoc task is successfully executed
      11. Check the local cache and confirm that there are now generated files for all of the installed themes (by default this is boost, clean, more, and bootstrap base)

      Test 2 - new install w/ db install separate

      1. Either uninstall the moodle instance you created in Test 1 or checkout a new copy of moodle
      2. Install moodle using the CLI installer admin/cli/install.php but make sure you use the --skip-database flag
      3. Confirm that no CSS files have been generated in the local cache
      4. Install the moodle database using the CLI installer admin/cli/install_database.php
      5. Repeat the testing from step 3 - 8 of Test 1 (don’t run the cron)

      Test 3 - upgrades

      1. Continue on from Test 2
      2. Note down the <revision> and <subrevision> numbers for the CSS in the local cache for Boost
      3. Edit your version.php file and increment the version
      4. Run the CLI upgrade script admin/cli/upgrade.php
      5. Check the local cache and confirm that the <revision> and <subrevision> have been updated (i.e. the Boost theme was recompiled as part of the upgrade)
      6. Check the task_adhoc table in your database and confirm that there is only one task for \core\task\build_installed_themes_task queued. The upgrade shouldn’t have queued a second one.
      7. Run the cron
      8. Confirm the adhoc task was executed and has been removed from the task_adhoc table
      9. Edit your version.php file again and increment the version
      10. Run the CLI upgrade script
      11. Check the task_adhoc table and confirm an adhoc task for \core\task\build_installed_themes_task has been added (the upgrade script should have added one this time because one didn’t already exist).
      Show
      Test 1 - new install w/ database Checkout a new moodle instance but don’t install it via the web UI Install moodle using the CLI installer admin/cli/install.php Check the task_adhoc table in your database and confirm that a \core\task\build_installed_themes_task task has been queued Check your local cache and confirm that a CSS file was generated for the default theme The default theme should be Boost The default local cache directory is in a sibling directory to your moodle install called moodledata . The CSS should be in moodledata/localcache/theme/<revision>/boost/css/all_<subrevision>.css Note down both the <revision> and <subrevision> numbers for the file in the local cache Open the dev tools in your browser and go to the network tab and filter for CSS requests Navigate to your new Moodle install Check the network tab and confirm the “all” stylesheet was loaded from the local cache (you can tell because the time to load will be in the milliseconds instead of seconds) Run cron Confirm that the adhoc task is successfully executed Check the local cache and confirm that there are now generated files for all of the installed themes (by default this is boost, clean, more, and bootstrap base) Test 2 - new install w/ db install separate Either uninstall the moodle instance you created in Test 1 or checkout a new copy of moodle Install moodle using the CLI installer admin/cli/install.php but make sure you use the --skip-database flag Confirm that no CSS files have been generated in the local cache Install the moodle database using the CLI installer admin/cli/install_database.php Repeat the testing from step 3 - 8 of Test 1 (don’t run the cron) Test 3 - upgrades Continue on from Test 2 Note down the <revision> and <subrevision> numbers for the CSS in the local cache for Boost Edit your version.php file and increment the version Run the CLI upgrade script admin/cli/upgrade.php Check the local cache and confirm that the <revision> and <subrevision> have been updated (i.e. the Boost theme was recompiled as part of the upgrade) Check the task_adhoc table in your database and confirm that there is only one task for \core\task\build_installed_themes_task queued. The upgrade shouldn’t have queued a second one. Run the cron Confirm the adhoc task was executed and has been removed from the task_adhoc table Edit your version.php file again and increment the version Run the CLI upgrade script Check the task_adhoc table and confirm an adhoc task for \core\task\build_installed_themes_task has been added (the upgrade script should have added one this time because one didn’t already exist).
    • Affected Branches:
      MOODLE_34_STABLE
    • Fixed Branches:
      MOODLE_34_STABLE
    • Pull Master Branch:
      MDL-59150-master-3

      Description

      Look at:

      • a Scheduled Task; or
      • an Adhoc Task; or
      • Grunt; or
      • Some combination of the above.

      This will help where course themes are in use, and to disperse the load away from the frontend.
      This will help hosted solutions in particular.

      We should pre-compile the current site theme after a cli upgrade.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  13/Nov/17