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

Add Moodle 3.9.0 upgrade line to all the upgrade.php scripts

XMLWordPrintable

    • Icon: Task Task
    • Resolution: Fixed
    • Icon: Minor Minor
    • 3.9.1
    • 3.9, 3.10
    • Installation
    • MOODLE_310_STABLE, MOODLE_39_STABLE
    • MOODLE_39_STABLE
    • Hide

      1) Check that all the "Command(s) to detect ..." in the description of the issue work as expected (no occurrences normally, some cases or exceptions allowed in some of them...)

      2) Check all upgrade scripts have the 3.9.0 comment before the return with:

       find . -ipath '*/db/upgrade.php' | xargs grep -B4 'return true;'
      

      • Random exceptions: Some upgrade scripts could be missing the comments before the return. Surely it's because some new steps already have been introduced after release. Verify the comments are present in the correct place (before those new steps).

      3) This should return nothing too or the same exceptions as in step 2:

      for u in `find . -name upgrade.php | grep 'db/upgrade'`; do grep -B4 'return true;' "$u" | grep "Automatically generated" > /dev/null; if [ $? -ne 0 ]; then echo "$u"; fi ; done
      

      4) Verify that the differences between the stable branch and master continue being 100% the same after the patch than before it (aka. the patch is 100% the same for both branches).

      5) rock on.

      Show
      1) Check that all the " Command(s) to detect ..." in the description of the issue work as expected (no occurrences normally, some cases or exceptions allowed in some of them...) 2) Check all upgrade scripts have the 3.9.0 comment before the return with: find . -ipath '*/db/upgrade.php' | xargs grep -B4 'return true;' Random exceptions: Some upgrade scripts could be missing the comments before the return. Surely it's because some new steps already have been introduced after release. Verify the comments are present in the correct place (before those new steps). 3) This should return nothing too or the same exceptions as in step 2: for u in `find . -name upgrade.php | grep 'db/upgrade'`; do grep -B4 'return true;' "$u" | grep "Automatically generated" > /dev/null; if [ $? -ne 0 ]; then echo "$u"; fi ; done 4) Verify that the differences between the stable branch and master continue being 100% the same after the patch than before it (aka. the patch is 100% the same for both branches). 5) rock on.

      In order to have it properly detected for the future it would be great to add to all the upgrade.php scripts some lines like these:

      // Automatically generated Moodle v3.9.0 release upgrade line.
      // Put any upgrade step following this.
      

      exactly before the "return true;" present in all the scripts.

      I think it's ok to do that both in the 39_STABLE and master branches, so they will allow quickly find where 3.9.0 started and act once we decide future requirements.

      The change can be performed globally with:

      #!/bin/bash
      export rel="3.9.0" && find . -name upgrade.php | \
      xargs grep -l 'function.*xmldb_.*_upgrade' | \
      grep '/db/' | \
      xargs grep -L "Automatically generated Moodle v${rel} release upgrade" | \
      xargs perl -p -i -e 's@( *)(return true;)@\1// Automatically generated Moodle v$ENV{rel} release upgrade line.\n\1// Put any upgrade step following this.\n\n\1\2@s'
      

      Command to detect all the upgrade.php files not having those lines:

      find . -name upgrade.php | xargs grep -l 'function.*xmldb_.*_upgrade' | grep '/db/' | xargs grep -L 'Automatically generated Moodle v3.9.0 release upgrade'
      

      Commands to detect that we have not added the lines to incorrect files:

      grep -lr 'Automatically generated Moodle v3.9.0 release upgrade' * | grep -v '/db/'
      grep -lr 'Automatically generated Moodle v3.9.0 release upgrade' * | xargs grep -L 'function.*xmldb_.*_upgrade'
      

      Command to detect if the lines have been added after a post-release upgrade step. If there are upgrade steps found verify that all them were already there the day of the release and have not been introduced later (you can look for differences between the release v3.9.0 and current master to verify that)

      export rel="3.9.0" && export ver="202006" &&
      find . -name upgrade.php | \
      xargs grep -B25 "Automatically generated Moodle v${rel} release upgrade" | \
      grep "upgrade_.*_savepoint.*${ver}"
      

      Ciao

        1. Screenshot_1.png
          214 kB
          Janelle Barcega
        2. Screenshot_2.png
          322 kB
          Janelle Barcega
        3. Screenshot_3.png
          231 kB
          Janelle Barcega

            stronk7 Eloy Lafuente (stronk7)
            stronk7 Eloy Lafuente (stronk7)
            Victor Déniz Falcón Victor Déniz Falcón
            Janelle Barcega Janelle Barcega
            Votes:
            0 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 - 1 hour, 45 minutes
                1h 45m

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