Moodle
  1. Moodle
  2. MDL-39753

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

    Details

    • Type: Task Task
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 2.5
    • Fix Version/s: 2.5.1
    • Component/s: Installation
    • Labels:
    • Testing Instructions:
      Hide

      1) find . -name upgrade.php | xargs grep -B4 'return true;' check all upgrade scripts have the v.2.5.0 comment before the return. Exception : ./question/upgrade.php isn't about db upgrade.
      2) check that the 3 commands in the description of the issue return 0 files.
      3) rock on.

      Show
      1) find . -name upgrade.php | xargs grep -B4 'return true;' check all upgrade scripts have the v.2.5.0 comment before the return. Exception : ./question/upgrade.php isn't about db upgrade. 2) check that the 3 commands in the description of the issue return 0 files. 3) rock on.
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_25_STABLE
    • Fixed Branches:
      MOODLE_25_STABLE
    • Pull from Repository:
    • Pull Master Branch:

      Description

      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:

      // Moodle v2.5.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 25_STABLE and master branches, so they will allow quickly find where 2.5.0 started and act once we decide future requirements.

      The change can be performed globally with:

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

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

      grep -lr 'Moodle v2.5.0 release upgrade' * | grep -v '/db/'
      grep -lr 'Moodle v2.5.0 release upgrade' * | xargs grep -L 'function.*xmldb_.*_upgrade'
      

      Ciao

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            Eloy Lafuente (stronk7) added a comment -

            Sending to integration, while doing this, it was detected that 2 files already had the 2.5 comments (incorrectly added):

            • forum/db/upgrade.php: Because of MDL-5875
            • blocks/section_links/db/upgrade.php: Because of MDL-37535

            So, for those 2 files, it has been moved to correct place. All the other upgrade.php files were ok and the comment has been added normally to them.

            Show
            Eloy Lafuente (stronk7) added a comment - Sending to integration, while doing this, it was detected that 2 files already had the 2.5 comments (incorrectly added): forum/db/upgrade.php: Because of MDL-5875 blocks/section_links/db/upgrade.php: Because of MDL-37535 So, for those 2 files, it has been moved to correct place. All the other upgrade.php files were ok and the comment has been added normally to them.
            Hide
            Dan Poltawski added a comment -

            Integrated to master and 25, thanks Eloy.

            Note that just before this issue, I integrated changes adding upgrade files to auth/ldap and auth/cas, they already had the right upgrade lines in place.

            Show
            Dan Poltawski added a comment - Integrated to master and 25, thanks Eloy. Note that just before this issue, I integrated changes adding upgrade files to auth/ldap and auth/cas, they already had the right upgrade lines in place.
            Hide
            Dan Poltawski added a comment -

            All the commands check out correctly, but perhaps I will leave this 'testing in progress' so that Eloy can double check the auth/ldap auth/cas upgrade lines.

            Show
            Dan Poltawski added a comment - All the commands check out correctly, but perhaps I will leave this 'testing in progress' so that Eloy can double check the auth/ldap auth/cas upgrade lines.
            Hide
            Eloy Lafuente (stronk7) added a comment -

            Yeah, they are perfect, the steps are AFTER release so the comment must be before step.

            Just they are missing the trailing dot, but who cares, not me, lol.

            So +1 to pass this, thanks!

            Show
            Eloy Lafuente (stronk7) added a comment - Yeah, they are perfect, the steps are AFTER release so the comment must be before step. Just they are missing the trailing dot, but who cares, not me, lol. So +1 to pass this, thanks!
            Hide
            Damyon Wiese added a comment -

            Thanks for your contribution! This issue has been reviewed, integrated, tested and now released to everyone.

            Closing as Fixed!

            Show
            Damyon Wiese added a comment - Thanks for your contribution! This issue has been reviewed, integrated, tested and now released to everyone. Closing as Fixed!

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: