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

Check for removed files before CLI upgrade

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide
      1. Create/check out a 3.10.x site. For example:

        $ git checkout MOODLE_310_STABLE
        

      2. Install the 3.10 site
      3. Check out the the branch for the instance that you're testing. e.g. for 311

        $ git checkout MOODLE_311_STABLE
        

      4. Create any of the following files that are being detected by the patch:

        $ touch lib/coursecatlib.php
        

      5. Run the CLI upgrade script:

         $ sudo -u www-data php admin/cli/upgrade.php
        

      6. Confirm that an error ("Mixed Moodle versions detected....") is displayed saying that there are problems upgrading, describing the correct procedure for upgrading to a major release
      7. Delete the created file from step 4
      8. Re-run the CLI upgrade script
      9. Confirm that the upgrade proceeds
      Show
      Create/check out a 3.10.x site. For example: $ git checkout MOODLE_310_STABLE Install the 3.10 site Check out the the branch for the instance that you're testing. e.g. for 311 $ git checkout MOODLE_311_STABLE Create any of the following files that are being detected by the patch: $ touch lib/coursecatlib.php Run the CLI upgrade script:  $ sudo -u www-data php admin/cli/upgrade.php Confirm that an error ("Mixed Moodle versions detected....") is displayed saying that there are problems upgrading, describing the correct procedure for upgrading to a major release Delete the created file from step 4 Re-run the CLI upgrade script Confirm that the upgrade proceeds
    • Affected Branches:
      MOODLE_38_STABLE, MOODLE_39_STABLE
    • Fixed Branches:
      MOODLE_311_STABLE
    • Pull 3.11 Branch:
      MDL-69460-311
    • Pull Master Branch:

      Description

      When upgrading via the web interface, if the source code directory contains files from previous versions you get the error "Mixed Moodle versions detected, upgrade cannot continue" (MDL-30929).

      When upgrading using admin/cli/upgrade.php this check does not occur and the upgrade proceeds.

      I suggest that the CLI script should also perform this check, exiting with an error if it fails. I think there are third party web platform managers (e.g. Softaculous) which are overwriting existing Moodle directories with later versions then running the CLI script. This apparently completes successfully but can result in a non-working site. E.g. upgrade Moodle 3.4 to 3.9 (via 3.5) overwriting the files there's a JavaScript exception:

      TypeError: Cannot call a class as a function

      This breaks navigation, e.g. the site administration page's tabs don't work.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              pholden Paul Holden
              Reporter:
              leonstr Leon Stringer
              Peer reviewer:
              Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
              Integrator:
              Andrew Lyons Andrew Lyons
              Tester:
              Gladys Basiana Gladys Basiana
              Participants:
              Component watchers:
              Matteo Scaramuccia, Andrew Lyons, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                17/May/21

                  Time Tracking

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