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

Moodle 3.9 upgrade fails due to missing column in privacy plugins if standalone GDPR plugins were used

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      Prerequisites
      1. Recommended to have MDK installed.
      2. Multiple PHP versions available:
        • Moodle 3.3 only supports up to PHP 7.0.
        • For Moodle 3.5 and up parts of the test, you may switch to PHP 7.2.
      Upgrade test
      1. Switch to PHP 7.0
      2. Make a fresh installation of Moodle 3.3.7

        git checkout v3.3.7
        mdk install 
        

      3. Clone the data privacy tool

        git clone git@github.com:moodlehq/moodle-tool_dataprivacy.git admin/tool/dataprivacy
        

      4. Check out the 33.1.0 version of the tool.

        cd admin/tool/dataprivacy
        git checkout 33.1.0
        

      5. Install the tool by upgrading the site.

        php admin/cli/upgrade.php
        

      6. Delete the tool's folder

        rm -rf admin/tool/dataprivacy
        

      7. Switch to PHP 7.2
      8. Check out and upgrade your site to Moodle 3.5.0 (You need to do so before you can install higher versions of Moodle)

        git checkout v3.5.0
        php admin/cli/upgrade.php
        

      9. Check out the branch you're testing with this patch applied (e.g. "git checkout MOODLE_35_STABLE")
      10. Upgrade your site.

        php admin/cli/upgrade.php
        

      11. Confirm that the upgrade completes successfully.
      12. Check the database schema.

        php admin/cli/check_database_schema.php
        

      13. Confirm that you get the message "Database structure is ok."
      Show
      Prerequisites Recommended to have MDK installed. Multiple PHP versions available: Moodle 3.3 only supports up to PHP 7.0. For Moodle 3.5 and up parts of the test, you may switch to PHP 7.2. Upgrade test Switch to PHP 7.0 Make a fresh installation of Moodle 3.3.7 git checkout v3.3.7 mdk install Clone the data privacy tool git clone git@github.com:moodlehq/moodle-tool_dataprivacy.git admin/tool/dataprivacy Check out the 33.1.0 version of the tool. cd admin/tool/dataprivacy git checkout 33.1.0 Install the tool by upgrading the site. php admin/cli/upgrade.php Delete the tool's folder rm -rf admin/tool/dataprivacy Switch to PHP 7.2 Check out and upgrade your site to Moodle 3.5.0 (You need to do so before you can install higher versions of Moodle) git checkout v3.5.0 php admin/cli/upgrade.php Check out the branch you're testing with this patch applied (e.g. " git checkout MOODLE_35_STABLE ") Upgrade your site. php admin/cli/upgrade.php Confirm that the upgrade completes successfully. Check the database schema. php admin/cli/check_database_schema.php Confirm that you get the message " Database structure is ok. "
    • Affected Branches:
      MOODLE_39_STABLE
    • Fixed Branches:
      MOODLE_39_STABLE
    • Pull 3.5 Branch:
    • Pull 3.7 Branch:
    • Pull 3.8 Branch:
    • Pull Master Branch:
      MDL-69049-master

      Description

      On a Moodle site which has used the standalone GDPR plugins on Moodle 3.4.x upgrading to Moodle 3.9 fails 

       
      DDL sql execution error

      More information about this error
      ×Debug info: Unknown column 'dpocommentformat' in 'mdl_tool_dataprivacy_request'
      ALTER TABLE mdl_tool_dataprivacy_request ADD systemapproved SMALLINT(4) NOT NULL DEFAULT 0 AFTER dpocommentformat
      Error code: ddlexecuteerror
      ×Stack trace: * line 492 of /lib/dml/moodle_database.php: ddl_change_structure_exception thrown

      • line 1098 of /lib/dml/mysqli_native_moodle_database.php: call to moodle_database->query_end()
      • line 77 of /lib/ddl/database_manager.php: call to mysqli_native_moodle_database->change_database_structure()
      • line 547 of /lib/ddl/database_manager.php: call to database_manager->execute_sql_arr()
      • line 333 of /admin/tool/dataprivacy/db/upgrade.php: call to database_manager->add_field()
      • line 692 of /lib/upgradelib.php: call to xmldb_tool_dataprivacy_upgrade()
      • line 1917 of /lib/upgradelib.php: call to upgrade_plugins()
      • line 711 of /admin/index.php: call to upgrade_noncore()
         

      This is due to MDL-66752 relying on the "dpocommentformat" column - https://github.com/moodle/moodle/blame/MOODLE_39_STABLE/admin/tool/dataprivacy/db/upgrade.php#L329

      Looking through the git history the dpocommentformat was added to the install.xml under MDL-61899 -https://github.com/moodle/moodle/blame/MOODLE_39_STABLE/admin/tool/dataprivacy/db/install.xml#L18 but no upgrade step was added during the integration from contrib to core.

      https://github.com/junpataleta/moodle/compare/6d4bc5bd34809683e2e2ada3ce52a3e0adf94de1...MDL-61899-master#diff-7c8777ea3672b712d762d3693af2d2a7R18

      Interestingly the upgrade step omission had actually been picked upon but never resolved.

      https://github.com/moodlehq/moodle-tool_dataprivacy/commit/574b3f2c42ad44d7890f719246e348bb364274ce#commitcomment-29398757

       

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              jpataleta Jun Pataleta
              Reporter:
              aspark Alistair Spark
              Peer reviewer:
              Eloy Lafuente (stronk7)
              Integrator:
              Víctor Déniz Falcón
              Tester:
              Janelle Barcega
              Participants:
              Component watchers:
              Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              2 Vote for this issue
              Watchers:
              13 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                13/Jul/20

                  Time Tracking

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