Moodle
  1. Moodle
  2. MDL-37032

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

    Details

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

      1) find . -name upgrade.php | xargs grep -B2 'return true;' check all upgrade scripts have at least one upgrade line. 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 -B2 'return true;' check all upgrade scripts have at least one upgrade line. 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_24_STABLE
    • Fixed Branches:
      MOODLE_24_STABLE
    • Rank:
      46572

      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.4.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 24_STABLE and master branches, so they will allow quickly find where 2.4.0 started and act once we decide future requirements.

      The change can be performed globally with:

      #!/bin/bash
      export rel="2.4.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.4.0 release upgrade'
      

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

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

      Ciao

        Issue Links

          Activity

          Hide
          Eric Poe added a comment -

          I have updated the master and MOODLE_24_STABLE branches.
          Master: https://github.com/epoe/moodle/tree/MDL-37032-update.php
          MOODLE_24_STABLE: https://github.com/epoe/moodle/tree/MDL-37032-update.php_24

          Show
          Eric Poe added a comment - I have updated the master and MOODLE_24_STABLE branches. Master: https://github.com/epoe/moodle/tree/MDL-37032-update.php MOODLE_24_STABLE: https://github.com/epoe/moodle/tree/MDL-37032-update.php_24
          Hide
          Aparup Banerjee added a comment -

          perhaps its a good idea to make a subtask too for the auto releasing scripts (jenkins).

          Show
          Aparup Banerjee added a comment - perhaps its a good idea to make a subtask too for the auto releasing scripts (jenkins).
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Hi Eric,

          many thanks for your collaboration. I was going to apply your patches, but finally I've decided to go and create my own ones because:

          1) There was already one new upgrade step introduced after release, so I need to move the 2.4 lines in lib/db/upgrade.php

          2) It seems you don't have your git properly configured with your fullname and email. And to get proper credits it's recommended to have both defined. See: https://help.github.com/articles/setting-your-username-in-git and https://help.github.com/articles/setting-your-email-in-git

          Thanks!

          Show
          Eloy Lafuente (stronk7) added a comment - Hi Eric, many thanks for your collaboration. I was going to apply your patches, but finally I've decided to go and create my own ones because: 1) There was already one new upgrade step introduced after release, so I need to move the 2.4 lines in lib/db/upgrade.php 2) It seems you don't have your git properly configured with your fullname and email. And to get proper credits it's recommended to have both defined. See: https://help.github.com/articles/setting-your-username-in-git and https://help.github.com/articles/setting-your-email-in-git Thanks!
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Hi Apu,

          sure it's one of the things to automate for major releases, although we are still far from automate majors. From January, with CVS out from the process, surely we'll start automating weeklies.

          Show
          Eloy Lafuente (stronk7) added a comment - Hi Apu, sure it's one of the things to automate for major releases, although we are still far from automate majors. From January, with CVS out from the process, surely we'll start automating weeklies.
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Integrated (24 and master).

          Show
          Eloy Lafuente (stronk7) added a comment - Integrated (24 and master).
          Hide
          Eloy Lafuente (stronk7) added a comment -

          And passed.

          Show
          Eloy Lafuente (stronk7) added a comment - And passed.
          Hide
          Eric Poe added a comment -

          Eloy, thanks for looking at my submission and pointing me in the right direction. <doh!>Reason #2 has been corrected.</doh!>

          Show
          Eric Poe added a comment - Eloy, thanks for looking at my submission and pointing me in the right direction. <doh!>Reason #2 has been corrected.</doh!>
          Hide
          Eloy Lafuente (stronk7) added a comment -

          lol, thanks Eric! And welcome!

          Show
          Eloy Lafuente (stronk7) added a comment - lol, thanks Eric! And welcome!
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Many thanks for your effort, the whole Moodle Community will be enjoying your great solutions starting now!

          Closing, ciao

          Show
          Eloy Lafuente (stronk7) added a comment - Many thanks for your effort, the whole Moodle Community will be enjoying your great solutions starting now! Closing, ciao

            People

            • Assignee:
              Eloy Lafuente (stronk7)
              Reporter:
              Eloy Lafuente (stronk7)
              Peer reviewer:
              Eloy Lafuente (stronk7)
              Integrator:
              Eloy Lafuente (stronk7)
              Tester:
              Eloy Lafuente (stronk7)
              Participants:
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: