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

Failed environment.xml check does not prevent plugin from being installed

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Requirements

      • Ability to edit the source code during upgrades.
      • Ability to execute both web and CLI upgrades.

      Scenario 1: Web upgrade triggered by the plugin version bump

      1. Ensure that your test Moodle install is fully up to date by going to Admin / Notifications.
      2. Save the attached environment.xml file into the blocks/html folder.
      3. Edit blocks/html/version.php and increment $plugin->version by 1.
      4. Go to Admin / Notifications.
      5. Verify that you see the environment check page, with title 'Current release information' and that it complains that you do not have PHP 9 installed!
      6. Edit the blocks/html/environment.xml file, to change 9.0.0 to 7.0.0 and click reload.
      7. Verify you see an all-green environment check page.
      8. Click continue.
      9. Verify that you see the plugin check page.

      No need to complete the upgrade.

      Scenario 2: CLI upgrade triggered by the plugin version bump

      1. Ensure that your test Moodle install is fully up to date by going to Admin / Notifications.
      2. Save the attached environment.xml file into the blocks/html folder.
      3. Edit blocks/html/version.php and increment $plugin->version by 1.
      4. Execute the CLI upgrade. This will depend on your environment, but generally it is something like

        $ sudo -u www-data php admin/cli/upgrade.php
        

      5. Verify that you see the "== Environment ==" section with the "!! php !!" check failed because the "Block / HTML" plugin required you to have PHP 9 installed and the upgrade does not happen.
      6. Edit the blocks/html/environment.xml file, to change 9.0.0 to 7.0.0 and run the upgrade again.
      7. Verify the upgrade can continue normally without any environment errors reported (note that CLI does not show the "ok" checks)

      Remember to delete blocks/html/environment.xml and reset the version number in blocks/html/version.php.

      Show
      Requirements Ability to edit the source code during upgrades. Ability to execute both web and CLI upgrades. Scenario 1: Web upgrade triggered by the plugin version bump Ensure that your test Moodle install is fully up to date by going to Admin / Notifications. Save the attached environment.xml file into the blocks/html folder. Edit blocks/html/version.php and increment $plugin->version by 1. Go to Admin / Notifications. Verify that you see the environment check page, with title 'Current release information' and that it complains that you do not have PHP 9 installed! Edit the blocks/html/environment.xml file, to change 9.0.0 to 7.0.0 and click reload. Verify you see an all-green environment check page. Click continue. Verify that you see the plugin check page. No need to complete the upgrade. Scenario 2: CLI upgrade triggered by the plugin version bump Ensure that your test Moodle install is fully up to date by going to Admin / Notifications. Save the attached environment.xml file into the blocks/html folder. Edit blocks/html/version.php and increment $plugin->version by 1. Execute the CLI upgrade. This will depend on your environment, but generally it is something like $ sudo -u www-data php admin/cli/upgrade.php Verify that you see the "== Environment ==" section with the "!! php !!" check failed because the "Block / HTML" plugin required you to have PHP 9 installed and the upgrade does not happen. Edit the blocks/html/environment.xml file, to change 9.0.0 to 7.0.0 and run the upgrade again. Verify the upgrade can continue normally without any environment errors reported (note that CLI does not show the "ok" checks) Remember to delete blocks/html/environment.xml and reset the version number in blocks/html/version.php.
    • Affected Branches:
      MOODLE_27_STABLE, MOODLE_28_STABLE, MOODLE_29_STABLE, MOODLE_30_STABLE, MOODLE_37_STABLE, MOODLE_38_STABLE
    • Fixed Branches:
      MOODLE_37_STABLE, MOODLE_38_STABLE
    • Pull from Repository:
    • Pull 3.7 Branch:
      MDL-52319-37-environmentxml
    • Pull 3.8 Branch:
      MDL-52319-38-environmentxml
    • Pull Master Branch:
      MDL-52319-master-environmentxml

      Description

      As a result of MDL-39840 and MDL-48177 the additional plugins can now provide their own environment.xml file - see https://docs.moodle.org/dev/Plugin_files#environment.xml

      However, the file does not seem to be checked when installing or upgrading the plugin. So the admin would have to manually visit the Site administration > Server > Environment page to find out if there is some missing requirement. And that can be too late already.

      I would expect that failed checks prevent installation / upgrade of the plugin.

        Attachments

        1. environment.xml
          0.3 kB
        2. MDL-52319_Scenario1.jpg
          MDL-52319_Scenario1.jpg
          64 kB
        3. MDL-52319_Scenario1 (2).jpg
          MDL-52319_Scenario1 (2).jpg
          19 kB
        4. MDL-52319_Scenario2.jpg
          MDL-52319_Scenario2.jpg
          50 kB
        5. screenshot-1.png
          screenshot-1.png
          16 kB
        6. screenshot-2.png
          screenshot-2.png
          24 kB

          Issue Links

            Activity

              People

              Assignee:
              timhunt Tim Hunt
              Reporter:
              mudrd8mz David Mudrák (@mudrd8mz)
              Peer reviewer:
              David Mudrák (@mudrd8mz)
              Integrator:
              Andrew Nicols
              Tester:
              Anna Carissa Sadia
              Participants:
              Component watchers:
              Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Matteo Scaramuccia, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              5 Vote for this issue
              Watchers:
              10 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                11/May/20

                  Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 day, 1 hour, 47 minutes
                  1d 1h 47m