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

Allow plugins to declare which major stable versions of moodle are supported

XMLWordPrintable

    • MOODLE_34_STABLE, MOODLE_38_STABLE
    • MOODLE_39_STABLE
    • mdl-59562
    • Hide

      1) Clone a test plugin for use in testing

      • Open a terminal in Moodle directory
      • git clone git@github.com:Peterburnett/mdl-59562-tester.git admin/tool/versiontester
        

      2) Attempt to install the plugin

      • Visit /admin/index.php
      • Verify that the requires column for the plugin shows 'Incompatible Moodle version: 39
      • Verify that a fails flag is displayed next to the requires text
      • Verify that the 'to be installed' flag in the status section shows warning colours

      3) Continue with the installation

      • Click 'Upgrade Moodle database now'
      • Check that a Warning notification is displayed at the top of the table
      • Click 'Continue' and verify that you cannot proceed with the installation

      4) Comment  out the incompatible statement

      • In the terminal, use a text editor to open the version.php file of the plugin
      • vim admin/tool/versiontester/version.php
        

      • Comment out the incompatible statement
      • //$plugin->incompatible = 39;
        

      • Save the changes to the file

       5) Attempt to install the plugin again

      • Visit /admin/index.php
      • Verify the requires field states 'Requires Moodle 31-37' instead of the Moodle version number
      • Verify that there is a message underneath the requires statement 'Plugin may not be compatible with Moodle version 39'
      • Click 'Upgrade Moodle database now' and verify the plugin still installs correctly, even with the warning

      6) Uninstall the plugin

      • In the terminal, run the CLI uninstall tool for the plugin
      • php admin/cli/uninstall_plugins.php --plugins=tool_versiontester --run
        

      • Now edit the ranges of support so the current version is supported
      • vim admin/tool/versiontester/version.php

      • $plugin->supported = [31, 39];

      • Save the changes to the file

      7) Attempt to install the plugin again

      • Visit /admin/index.php
      • Verify that the requires field still shows the range 'Requires Moodle 31-39'
      • Verify that a warning is no longer displayed for the plugin
      • Click 'Upgrade Moodle database now'
      • Verify the plugin installed correctly with no errors

      8) Uninstall the plugin and edit the file one more time to comment out the support declaration

      • php admin/cli/uninstall_plugins.php --plugins=tool_versiontester --run
        

      • vim admin/tool/versiontester/version.php
        

      • //$plugin->supported = [31, 39];

      • Save changes to the file

      9) Attempt to install the plugin

      • Visit /admin/index.php
      • Verify that the requires column now defaults back the Moodle long version number
      • Click 'Upgrade Moodle database now'
      • Verify that the plugin installed correctly

       10) Uninstall the plugin and uncomment the incompatible declaration

      • php admin/cli/uninstall_plugins.php --plugins=tool_versiontester --run
        

      • vim admin/tool/versiontester/version.php
        

      • $plugin->incompatible = 39;
        

      11)  Attempt to install the plugin via cli/upgrade.php

      • php admin/cli/upgrade.php
        

      • Verify that the tool will not run
      • Verify that it states 'Dependencies check failed for tool_versiontester' Similar to the webpage version
      • Edit the version file to remove the incompatible declaration
      • vim admin/tool/versiontester/version.php

      • //$plugin->incompatible = 39;

      • Rerun the upgrade script, and verify that the upgrade completes successfully
      • php admin/cli/upgrade.php

      • Now uninstall the plugin again.
      • php admin/cli/uninstall_plugins.php --plugins=tool_versiontester --run
        

      12) To test the exceptions incase of malformed syntax, edit the plugin, and change the incompatible statement to be malformed:

      • vim admin/tool/versiontester/version.php
        

      • $plugin->incompatible = -1;

      • Save the file, and go back to browser.
      • Visit /admin/index.php
      • Verify an exception is thrown
      • Verify the exception message states 'Coding error detected, it must be fixed by a programmer: Incorrect syntax in plugin incompatible declaration in versiontester'
      •  Edit the version file one more time to remove the incompatible statement, and introduce malformed supported
      • vim admin/tool/versiontester/version.php

      • //$plugin->incompatible = -1;

      • $plugin->supported = [31,39,-1];
        

      • Visit /admin/index.php
      • Verify an exception is thrown
      • Verify the exception message states 'Coding error detected, it must be fixed by a programmer: Incorrect syntax in plugin supported declaration in versiontester'

       

      Show
      1) Clone a test plugin for use in testing Open a terminal in Moodle directory git clone git @github .com:Peterburnett/mdl- 59562 -tester.git admin/tool/versiontester 2) Attempt to install the plugin Visit /admin/index.php Verify that the requires column for the plugin shows 'Incompatible Moodle version: 39 Verify that a fails flag is displayed next to the requires text Verify that the 'to be installed' flag in the status section shows warning colours 3) Continue with the installation Click 'Upgrade Moodle database now' Check that a Warning notification is displayed at the top of the table Click 'Continue' and verify that you cannot proceed with the installation 4) Comment  out the incompatible statement In the terminal, use a text editor to open the version.php file of the plugin vim admin/tool/versiontester/version.php Comment out the incompatible statement //$plugin->incompatible = 39; Save the changes to the file  5) Attempt to install the plugin again Visit /admin/index.php Verify the requires field states 'Requires Moodle 31-37' instead of the Moodle version number Verify that there is a message underneath the requires statement 'Plugin may not be compatible with Moodle version 39' Click 'Upgrade Moodle database now' and verify the plugin still installs correctly, even with the warning 6) Uninstall the plugin In the terminal, run the CLI uninstall tool for the plugin php admin/cli/uninstall_plugins.php --plugins=tool_versiontester --run Now edit the ranges of support so the current version is supported vim admin/tool/versiontester/version.php $plugin->supported = [ 31 , 39 ]; Save the changes to the file 7) Attempt to install the plugin again Visit /admin/index.php Verify that the requires field still shows the range 'Requires Moodle 31-39' Verify that a warning is no longer displayed for the plugin Click 'Upgrade Moodle database now' Verify the plugin installed correctly with no errors 8) Uninstall the plugin and edit the file one more time to comment out the support declaration php admin/cli/uninstall_plugins.php --plugins=tool_versiontester --run vim admin/tool/versiontester/version.php //$plugin->supported = [31, 39]; Save changes to the file 9) Attempt to install the plugin Visit /admin/index.php Verify that the requires column now defaults back the Moodle long version number Click 'Upgrade Moodle database now' Verify that the plugin installed correctly  10) Uninstall the plugin and uncomment the incompatible declaration php admin/cli/uninstall_plugins.php --plugins=tool_versiontester --run vim admin/tool/versiontester/version.php $plugin->incompatible = 39 ; 11)  Attempt to install the plugin via cli/upgrade.php php admin/cli/upgrade.php Verify that the tool will not run Verify that it states 'Dependencies check failed for tool_versiontester' Similar to the webpage version Edit the version file to remove the incompatible declaration vim admin/tool/versiontester/version.php //$plugin->incompatible = 39; Rerun the upgrade script, and verify that the upgrade completes successfully php admin/cli/upgrade.php Now uninstall the plugin again. php admin/cli/uninstall_plugins.php --plugins=tool_versiontester --run 12) To test the exceptions incase of malformed syntax, edit the plugin, and change the incompatible statement to be malformed: vim admin/tool/versiontester/version.php $plugin->incompatible = - 1 ; Save the file, and go back to browser. Visit /admin/index.php Verify an exception is thrown Verify the exception message states 'Coding error detected, it must be fixed by a programmer: Incorrect syntax in plugin incompatible declaration in versiontester'  Edit the version file one more time to remove the incompatible statement, and introduce malformed supported vim admin/tool/versiontester/version.php //$plugin->incompatible = -1; $plugin->supported = [ 31 , 39 ,- 1 ]; Visit /admin/index.php Verify an exception is thrown Verify the exception message states 'Coding error detected, it must be fixed by a programmer: Incorrect syntax in plugin supported declaration in versiontester'  

      The version.php file has a way to declare which first major stable version is supported via:

      $plugin->requires = '2014010101';

      There are two problems with this:

      1) There is no possible way to declare that a particular stable is not supported. In particular when  API's are deprecated, in the plugin we need to have multiple branches which each declare exactly what major stables they support., and don't support.

      2) it's opaque and difficult to often match the date back to a stable version at a glance (admittedly a minor issue)

      What I'm suggesting is a new way of declaring support like this:

      $plugin->supports = array('2.9', '3.0', '3.1');

      The intent of this is to declare what is known to work, which may not necessarily be exhaustive and could be out of date when new sables arrive but still actually work.

      There could be a second array which explicitly declares what is known to not be supported too:

      $plugin->unsupported = array('3.2', '3.3');

      This data would be leveraged in a couple ways:

      • If 'supported' is provided AND the current version is not in the list, then at install / upgrade time a warning would be produced.
      • If 'unsupported' is provided AND the current version is in the list, or a lower value is, then this should be a hard install / upgrade failure. We can safely assume that if say 3.3 is not supported then all future versions after 3.4+ are also not supported. This value could just be the first unsupported version string, and not an array, as they are functionally identical.
      • In the Moodle plugin directory this info can be parsed out and use to automatically populate the plugin metadata. The plugin directory could be configured to ingest multiple git branches from github which each declare different support levels.

      The latter point is the more important part as I believe it is the last remaining piece of the puzzle which is blocking full automation of plugin publishing (MDLSITE-4781).

      Fully automating the plugin publishing into the plugins directory is a big deal. Maintaining the directory metadata is onerous and error prone and results in a lower level of trust in people trying to install stuff from there.

       

        1. MDL-59562_Step7_FAIL.jpg
          MDL-59562_Step7_FAIL.jpg
          47 kB
        2. MDL-59562.jpg
          MDL-59562.jpg
          41 kB
        3. MDL-59562 (2).jpg
          MDL-59562 (2).jpg
          71 kB
        4. MDL-59562 (3).jpg
          MDL-59562 (3).jpg
          69 kB
        5. MDL-59562 (4).jpg
          MDL-59562 (4).jpg
          78 kB

            peterburnett Peter Burnett
            brendanheywood Brendan Heywood
            Brendan Heywood Brendan Heywood
            Andrew Lyons Andrew Lyons
            Anna Carissa Sadia Anna Carissa Sadia
            Votes:
            15 Vote for this issue
            Watchers:
            20 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 6 hours, 55 minutes
                6h 55m

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