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

Uninstalling Cohort roles tool can break site upgrade

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Similar to the testing instructions in MDL-67458, we just need to test the upgrade after uninstalling tool_cohortroles

      Master

      1. Check out the following(resp)
        • Master: git checkout 8cf4c97217230e74
        • 38: git checkout 773b1f738fa
        • 37: git checkout fcc93935bea
      2. Install site
      3. Navigate to Plugins > Admin tools > Manage admin tools in Site administration
      4. Uninstall the Cohort roles management plugin
      5. Confirm uninstallation, and ensure the plugin files are fully removed (prevent re-installation)
      6. git checkout master
      7. Navigate to Site administration
      8. Run upgrade procedure
      9. Confirm upgrade completes without failures
      Show
      Similar to the testing instructions in MDL-67458 , we just need to test the upgrade after uninstalling tool_cohortroles Master Check out the following(resp) Master: git checkout 8cf4c97217230e74 38: git checkout 773b1f738fa 37: git checkout fcc93935bea Install site Navigate to Plugins > Admin tools > Manage admin tools in Site administration Uninstall the Cohort roles management plugin Confirm uninstallation, and ensure the plugin files are fully removed (prevent re-installation) git checkout master Navigate to Site administration Run upgrade procedure Confirm upgrade completes without failures
    • Affected Branches:
      MOODLE_37_STABLE, MOODLE_38_STABLE
    • Fixed Branches:
      MOODLE_37_STABLE, MOODLE_38_STABLE
    • Pull 3.8 Branch:
    • Pull Master Branch:

      Description

      As reported in the following thread: https://moodle.org/mod/forum/discuss.php?d=396403

      The changes in MDL-67458 introduced an upgrade step that cleans up Cohort role records for roles that no longer exist. Unfortunately if you have removed that plugin prior to upgrading, the step will fail with a DML exception:

      Debug info: ERROR: relation "m_tool_cohortroles" does not exist
      LINE 1: DELETE FROM m_tool_cohortroles WHERE roleid NOT IN (SELECT i...
      ^
      DELETE FROM m_tool_cohortroles WHERE roleid NOT IN (SELECT id FROM m_role)
      [array (
      )]
      Error code: dmlwriteexception
      Stack trace:
       
          line 489 of /lib/dml/moodle_database.php: dml_write_exception thrown
          line 259 of /lib/dml/pgsql_native_moodle_database.php: call to moodle_database->query_end()
          line 1282 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end()
          line 2110 of /lib/db/upgrade.php: call to pgsql_native_moodle_database->delete_records_select()
          line 1850 of /lib/upgradelib.php: call to xmldb_main_upgrade()
          line 518 of /admin/index.php: call to upgrade_core()
      

        Attachments

          Activity

            People

            Assignee:
            pholden Paul Holden
            Reporter:
            pholden Paul Holden
            Peer reviewer:
            Peter Dias
            Integrator:
            Sara Arjona (@sarjona)
            Tester:
            Anna Carissa Sadia
            Participants:
            Component watchers:
            Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Sara Arjona (@sarjona)
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              9/Mar/20

                Time Tracking

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 3 hours, 10 minutes
                3h 10m