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

Stricter validation of upgrade savepoint components

XMLWordPrintable

    • MOODLE_404_STABLE
    • MOODLE_403_STABLE, MOODLE_404_STABLE
    • MDL-81870-403
    • MDL-81870-404
    • Hide

      Setup

      1. Checkout previous release (so we have some upgrade steps to run):

        $ git checkout v4.2.0
        

      2. Install site
      3. Checkout MDL-81870 branch (or main for testers)

        $ git checkout <branch>
        

      4. Manually edit blocks/badges/db/upgrade.php (because there aren't any blocks with upgrade steps)
      5. Add the following immediately before the return true; statement:

            if ($oldversion < 2024042200) {
                // Nothing.
                upgrade_block_savepoint(true, 2024042200, 'badges');
            }
        

      Perform upgrade of valid components

      1. Access site and perform upgrade
      2. Confirm upgrade completes successfully
      3. Log in as admin

      Perform upgrade of invalid block plugin

      1. Manually edit blocks/badges/db/upgrade.php (again)
      2. Add the following immediately before the return true; statement:

            if ($oldversion < 2024052200) {
                // Nothing.
                upgrade_block_savepoint(true, 2024052200, 'badge');
            }
        

      3. Manually edit blocks/badges/version.php, change $version equal to 2024052200
      4. Navigate to site administration
      5. Confirm you want to upgrade Latest badges block
      6. Confirm you see the following error:

        block_badge plugin doesn't exist
        

      7. Undo the changes from steps 2. & 3.

      Perform upgrade of invalid activity plugin

      1. Manually edit mod/forum/db/upgrade.php
      2. Add the following immediately before the return true; statement:

            if ($oldversion < 2024052200) {
                // Nothing.
                upgrade_mod_savepoint(true, 2024052200, 'form');
            }
        

      3. Manually edit mod/forum/version.php, change $version equal to 2024052200
      4. Navigate to site administration
      5. Confirm you want to upgrade Forum activity
      6. Confirm you see the following error:

        mod_form plugin doesn't exist
        

      7. Undo the changes from steps 2. & 3.

      Perform upgrade of invalid general plugin

      1. Manually edit question/bank/columnsortorder/db/upgrade.php
      2. Add the following immediately before the return true; statement:

            if ($oldversion < 2024052200) {
                // Nothing.
                upgrade_plugin_savepoint(true, 2024052200, 'qbank', 'qbank_columnsortorder');
            }
        

      3. Manually edit question/bank/columnsortorder/version.php, change $version equal to 2024052200
      4. Navigate to site administration
      5. Confirm you want to upgrade Column sort order plugin
      6. Confirm you see the following error:

        qbank_qbank_columnsortorder plugin doesn't exist
        

      7. Undo the changes from steps 2. & 3.
      Show
      Setup Checkout previous release (so we have some upgrade steps to run): $ git checkout v4.2.0 Install site Checkout MDL-81870 branch (or main for testers) $ git checkout <branch> Manually edit blocks/badges/db/upgrade.php (because there aren't any blocks with upgrade steps) Add the following immediately before the return true; statement: if ($oldversion < 2024042200) { // Nothing. upgrade_block_savepoint(true, 2024042200, 'badges'); } Perform upgrade of valid components Access site and perform upgrade Confirm upgrade completes successfully Log in as admin Perform upgrade of invalid block plugin Manually edit blocks/badges/db/upgrade.php (again) Add the following immediately before the return true; statement: if ($oldversion < 2024052200) { // Nothing. upgrade_block_savepoint(true, 2024052200, 'badge'); } Manually edit blocks/badges/version.php , change $version equal to 2024052200 Navigate to site administration Confirm you want to upgrade Latest badges block Confirm you see the following error: block_badge plugin doesn't exist Undo the changes from steps 2. & 3. Perform upgrade of invalid activity plugin Manually edit mod/forum/db/upgrade.php Add the following immediately before the return true; statement: if ($oldversion < 2024052200) { // Nothing. upgrade_mod_savepoint(true, 2024052200, 'form'); } Manually edit mod/forum/version.php , change $version equal to 2024052200 Navigate to site administration Confirm you want to upgrade Forum activity Confirm you see the following error: mod_form plugin doesn't exist Undo the changes from steps 2. & 3. Perform upgrade of invalid general plugin Manually edit question/bank/columnsortorder/db/upgrade.php Add the following immediately before the return true; statement: if ($oldversion < 2024052200) { // Nothing. upgrade_plugin_savepoint(true, 2024052200, 'qbank', 'qbank_columnsortorder'); } Manually edit question/bank/columnsortorder/version.php , change $version equal to 2024052200 Navigate to site administration Confirm you want to upgrade Column sort order plugin Confirm you see the following error: qbank_qbank_columnsortorder plugin doesn't exist Undo the changes from steps 2. & 3.

      This comes from a discussion with timhunt in MDL-81867 - we can avoid the type of errors there (& MDL-77774) with some stricter validation inside the upgrade_plugin_savepoint(...) calls to ensure we aren't creating phantom plugin entries (or at the very least that method ought to handle this more gracefully)

            pholden Paul Holden
            pholden Paul Holden
            Tim Hunt Tim Hunt
            Andrew Lyons Andrew Lyons
            Ron Carl Alfon Yu Ron Carl Alfon Yu
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 hours, 9 minutes
                2h 9m

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