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

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

XMLWordPrintable

    • MOODLE_27_STABLE, MOODLE_28_STABLE, MOODLE_29_STABLE, MOODLE_30_STABLE, MOODLE_37_STABLE, MOODLE_38_STABLE
    • MOODLE_37_STABLE, MOODLE_38_STABLE
    • MDL-52319-master-environmentxml
    • 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.

      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.

        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

            timhunt Tim Hunt
            mudrd8mz David Mudrák (@mudrd8mz)
            David Mudrák (@mudrd8mz) David Mudrák (@mudrd8mz)
            Andrew Lyons Andrew Lyons
            Anna Carissa Sadia Anna Carissa Sadia
            Votes:
            5 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved:

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

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.