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

Introduce mechanism for plugin type deprecation

XMLWordPrintable

    • MOODLE_500_STABLE
    • MOODLE_500_STABLE
    • MDL-79843-main-fix
    • Hide

      Note: This test uses a test branch, based on integration, with the commits from the LTI migration epic also included, and where the 'ltiservice' mod_lti subplugin has been fully removed and deprecated (per the deprecation policy introduced in this patch).

      Setup - install a site with a dummy 3rd party plugin

      Note: this simulates a real site, which may have 3rd party plugins installed at the time of plugin type deprecation.

      1. Apply a dummy 3rd party service plugin. In the root of your site:

        cd mod/lti/service
        git clone https://github.com/snake/ltiservice_testservice.git testservice
        

      2. Now, run the site upgrade and make sure the dummy plugin is installed (you can see it on the site admin plugins overview, listed as an additional plugin). At this stage, this is just a useless plugin, but we'll use it to see what happens when we deprecate the plugin type.

      Phase 1 deprecation (deprecation) test

      1. Checkout the test branch

        git checkout main
        git fetch https://github.com/snake/moodle.git MDL-79843-testing
        git merge FETCH_HEAD
        

      2. Go to your site. You should be prompted to upgrade (a part of deprecating these plugintypes is version bumping, to ensure upgrade is triggered)
      3. Proceed past the env checks to the plugins check
      4. Verify:
        • You see a red pill with "Deprecated plugin type" text for the 'testservice' plugin
        • You see nothing in the "new version" column of the testservice plugin
          Note: Ignore the other plugins being removed - that's expected for this branch.
      5. Don't do anything in the web ui yet.
      6. In an editor, bump the version number in the plugin's version.php (mod/lti/service/testservice/version.php).
      7. Now, reload the page in the browser
      8. Verify you still see nothing in the "new version" column (i.e. deprecated plugins aren't being flagged for upgrade if version incremented)
      9. In your editor, change the version number back again
      10. Now reload the page and this time proceed with the site upgrade
        Note: ignore any capability deprecation warnings/errors. These are worsened with debugging on. When you see them, just reload the page to get past them.
      11. Once the upgrade completes, go to 'Site admin > Plugins > Overview'
      12. Scroll to the bottom
      13. Verify:
        • you see ltiservice_testservice listed in a yellow / warning row.
        • It has pills for 'additional' and 'deprecated plugin type'
        • The deprecated plugin type is shown as red/error
        • There is no 'enabled' or 'settings' in the row
        • There is an uninstall link in the row.
      14. Click to uninstall the plugin
      15. Click to proceed
      16. Verify the plugin is uninstalled and you see the notice about removing the directory
      17. Click 'continue'
      18. Proceed past the env checks to the plugin checks
      19. At this screen, Verify you don't see the ltiservice_testservice plugin listed for reinstallation (this, again, is expected for a deprecated plugin type)
      20. Continue with the DB upgrade and verify no errors
      21. Go to "Site admin > Plugins > Overview"
      22. Verify you no longer see 'ltiservice_testservice' listed
      23. Remove this site entirely. We'll use a fresh site for the next part.

      Phase 2 deprecation (deletion) test

      1. Complete the entire setup process again, so you have a new site, with the 'testservice' plugin installed.
      2. Checkout the test branch

        git checkout main
        git fetch https://github.com/snake/moodle.git MDL-79843-testing
        git merge FETCH_HEAD
        

      3. Now, in your site, run through the upgrade process as you did in the earlier test
      4. Once site upgrade completes, just wait there
      5. Now, in your editor, modify the file 'mod/lti/subplugins.json'
      6. Change the following from:

        "deprecatedsubplugintypes": {
            "ltiservice": "service"
        }
        

        to:

        "deletedsubplugintypes": {
            "ltiservice": "service"
        }
        

      7. Save the file
      8. Bump the site version number (edit version.php)
      9. Go to the site, where upgrade should be triggered
      10. Try to proceed
      11. Verify:
        • that site upgrade is now blocked on the env checks step
        • You see a row for the ltiservice_testservice plugin containing information reading 'Deleted plugin detected', a message explaining what needs to be done, the plugin name and a red 'check' pill
        • That you cannot proceed with the site upgrade at this point in time
      12. Now, run the following in your terminal:

        php admin/cli/uninstall_plugins.php --plugins=ltiservice_testservice --run
        

      13. Verify the uninstallation completes without errors.
      14. Reload the web page now
      15. Verify:
        • you no longer see the blocker notice about the deleted plugin type
        • you can see the 'continue' button now
      16. Click 'continue' and proceed with site upgrade, verifying it completes without errors.
      17. Go to "Site admin > plugins > overview"
      18. Verify you cannot see the ltiservice_testservice plugin listed.
      19. Don't remove your site this time - we'll reuse it for the next bit.

      Phase 3 deprecation (final removal) test

      Continuing on from above...

      1. Again, edit the mod/lti/subplugins.json file
      2. Replace the entire contents of the file with the following (i.e. 'ltiservice' has now been completely removed from the subplugin definitions):

        "subplugintypes": {
            "ltisource": "source"
        },
        "plugintypes": {
            "ltisource": "mod/lti/source"
        },

      3. Again, bump the site version
      4. Proceed through the upgrade and verify no errors
      5. Go to "Site admin > plugins > overview"
      6. Verify you cannot see the ltiservice_testservice plugin listed.
      Show
      Note: This test uses a test branch, based on integration, with the commits from the LTI migration epic also included, and where the 'ltiservice' mod_lti subplugin has been fully removed and deprecated (per the deprecation policy introduced in this patch). Setup - install a site with a dummy 3rd party plugin Note: this simulates a real site, which may have 3rd party plugins installed at the time of plugin type deprecation. Apply a dummy 3rd party service plugin. In the root of your site: cd mod/lti/service git clone https://github.com/snake/ltiservice_testservice.git testservice Now, run the site upgrade and make sure the dummy plugin is installed (you can see it on the site admin plugins overview, listed as an additional plugin). At this stage, this is just a useless plugin, but we'll use it to see what happens when we deprecate the plugin type. Phase 1 deprecation (deprecation) test Checkout the test branch git checkout main git fetch https://github.com/snake/moodle.git MDL-79843-testing git merge FETCH_HEAD Go to your site. You should be prompted to upgrade (a part of deprecating these plugintypes is version bumping, to ensure upgrade is triggered) Proceed past the env checks to the plugins check Verify : You see a red pill with "Deprecated plugin type" text for the 'testservice' plugin You see nothing in the "new version" column of the testservice plugin Note: Ignore the other plugins being removed - that's expected for this branch. Don't do anything in the web ui yet. In an editor, bump the version number in the plugin's version.php (mod/lti/service/testservice/version.php). Now, reload the page in the browser Verify you still see nothing in the "new version" column (i.e. deprecated plugins aren't being flagged for upgrade if version incremented) In your editor, change the version number back again Now reload the page and this time proceed with the site upgrade Note: ignore any capability deprecation warnings/errors. These are worsened with debugging on. When you see them, just reload the page to get past them. Once the upgrade completes, go to 'Site admin > Plugins > Overview' Scroll to the bottom Verify : you see ltiservice_testservice listed in a yellow / warning row. It has pills for 'additional' and 'deprecated plugin type' The deprecated plugin type is shown as red/error There is no 'enabled' or 'settings' in the row There is an uninstall link in the row. Click to uninstall the plugin Click to proceed Verify the plugin is uninstalled and you see the notice about removing the directory Click 'continue' Proceed past the env checks to the plugin checks At this screen, Verify you don't see the ltiservice_testservice plugin listed for reinstallation (this, again, is expected for a deprecated plugin type) Continue with the DB upgrade and verify no errors Go to "Site admin > Plugins > Overview" Verify you no longer see 'ltiservice_testservice' listed Remove this site entirely. We'll use a fresh site for the next part. Phase 2 deprecation (deletion) test Complete the entire setup process again, so you have a new site, with the 'testservice' plugin installed. Checkout the test branch git checkout main git fetch https://github.com/snake/moodle.git MDL-79843-testing git merge FETCH_HEAD Now, in your site, run through the upgrade process as you did in the earlier test Once site upgrade completes, just wait there Now, in your editor, modify the file 'mod/lti/subplugins.json' Change the following from: "deprecatedsubplugintypes": { "ltiservice": "service" } to: "deletedsubplugintypes": { "ltiservice": "service" } Save the file Bump the site version number (edit version.php) Go to the site, where upgrade should be triggered Try to proceed Verify : that site upgrade is now blocked on the env checks step You see a row for the ltiservice_testservice plugin containing information reading 'Deleted plugin detected', a message explaining what needs to be done, the plugin name and a red 'check' pill That you cannot proceed with the site upgrade at this point in time Now, run the following in your terminal: php admin/cli/uninstall_plugins.php --plugins=ltiservice_testservice --run Verify the uninstallation completes without errors. Reload the web page now Verify : you no longer see the blocker notice about the deleted plugin type you can see the 'continue' button now Click 'continue' and proceed with site upgrade, verifying it completes without errors. Go to "Site admin > plugins > overview" Verify you cannot see the ltiservice_testservice plugin listed. Don't remove your site this time - we'll reuse it for the next bit. Phase 3 deprecation (final removal) test Continuing on from above... Again, edit the mod/lti/subplugins.json file Replace the entire contents of the file with the following (i.e. 'ltiservice' has now been completely removed from the subplugin definitions): "subplugintypes": { "ltisource": "source" }, "plugintypes": { "ltisource": "mod/lti/source" }, Again, bump the site version Proceed through the upgrade and verify no errors Go to "Site admin > plugins > overview" Verify you cannot see the ltiservice_testservice plugin listed.
    • Hide

      Code verified against automated checks with warnings.

      Checked MDL-79843 using repository: https://github.com/snake/moodle

      Should these errors be fixed?

      Built on: Wed 20 Nov 2024 05:50:08 PM UTC

      Show
      Code verified against automated checks with warnings. Checked MDL-79843 using repository: https://github.com/snake/moodle main (0 errors / 1 warnings) [branch: MDL-79843-main | CI Job ] overview (0/0) , phplint (0/0) , phpcs (0/0) , js (0/0) , css (0/0) , phpdoc (0/0) , commit (0/1) , savepoint (0/0) , thirdparty (0/0) , externalbackup (0/0) , grunt (0/0) , shifter (0/0) , mustache (0/0) , gherkin (0/0) , Should these errors be fixed? Built on: Wed 20 Nov 2024 05:50:08 PM UTC
    • Show
      Launching automatic jobs for branch MDL-79843 -main https://ci.moodle.org/view/Testing/job/DEV.02%20-%20Developer-requested%20PHPUnit/17440/ PHPUnit (sqlsrv) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/59484/ Behat (NonJS - boost and classic) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/59485/ Behat (Firefox - boost) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/59486/ Behat (Firefox - classic) https://ci.moodle.org/view/Testing/job/DEV.01%20-%20Developer-requested%20Behat/59487/ App tests (stable app version) Built on: Wed Nov 20 16:25:48 UTC 2024
    • 5
    • Team Alpha - Sprint 2 I2-2024, Team Alpha - Sprint 3 I2-2024, Team Alpha - Planning I3-2024, Team Alpha - Sprint 1 I3-2024, Team Alpha - Sprint 2 I3-2024, Team Alpha - Sprint 3 I3-2024, Team Alpha - Planning I4-2024, Team Alpha - Sprint 1 I4-2024, Team Alpha - Sprint 2 I4-2024

      This issue is scoped with creating a working model for deprecating subplugin types (or plugin types for that matter) - something we've not needed to do before, but will need to do as part of the end-of-life-ing the mod/lti/service subplugins in MDL-79109 (and, more specifically the task issue MDL-82299).

      At a high level, the goals are as follows:

      • Don't break an upgrading site when 3rd party plugins are installed and the site upgrades to a new Moodle version, where these subplugin types are no longer supported (and are deprecated). We need to allow these plugins to exist, albeit in a deprecated state.
        • If a plugin type is to be deprecated, core plugins will have to be moved/deleted first, however, this doesn't stop 3rd party plugins from being present in a given site.
      • Make it clear, during upgrade, that xxx plugins of the plugin type yyy are deprecated
      • Permit uninstall of the deprecated plugins/subplugins via site admin. While no code will call the plugin classes (this should have been removed prior to deprecation), we also need to allow clean removal of the plugins from the DB + file system, just like any other plugin.
        • Include some sort of indicators on the plugins overview in site admin (deprecated, end of life, whatever).
      • Ensure any async execution of plugin code is prevented while the plugin is still installed pending migration/uninstallation. Essentially, deprecation should only permit 3rd party maintainers to get their data out of the old plugin, should they need to (permitting things like migration to a replacement plugin type, for example). E.g. we need to ensure things like the following won't be executed within deprecated plugins:
        • Hooks
        • Callbacks + Class callbacks
        • Events
        • Tasks
        • Web services
        • Others ?...

      I'm proposing we implement a 3 phase deprecation process, as follows:

      1. Phase 1 - Deprecate
        • Achieved by adding a 'deprecatedplugintypes' entry to either components.json (core plugin types), or subplugins.json (for the respective plugin containing subplugins).
        • Move any deprecated plugin from the 'plugintypes' array to the 'deprecatedplugintypes' array
        • Bump version (not strictly needed since allversionhash will catch phase 1, but needed for phase 2)
      2. Phase 2 - Delete
        • Achieved by adding a 'deletedplugintypes' entry to either components.json (core plugin types), or subplugins.json (for the respective plugin containing subplugins)  
        • Move any deleted plugin from the 'deprecatedplugintypes' array to the 'deletedplugintypes' array
        • Site upgrade blocked (env checks require removal of deleted plugin type plugins)
      3. Phase 3 - Final removal
        • Remove the entry from 'deletedplugintypes' array entirely

        1. MDL-79843-3.png
          133 kB
          Ron Carl Alfon Yu
        2. MDL-79843-1.png
          1010 kB
          Ron Carl Alfon Yu
        3. MDL-79843-2.png
          866 kB
          Ron Carl Alfon Yu

            jaked Jake Dallimore
            ismael-texidor Ish Texidor-Rodriguez
            Mihail Geshoski Mihail Geshoski
            Andrew Lyons Andrew Lyons
            Ron Carl Alfon Yu Ron Carl Alfon Yu
            Votes:
            2 Vote for this issue
            Watchers:
            18 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 day, 7 hours, 14 minutes
                1d 7h 14m

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