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

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

    XMLWordPrintable

Details

    • Task
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • 2.5
    • 2.5.1
    • Installation
    • MOODLE_25_STABLE
    • MOODLE_25_STABLE
    • Easy
    • 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.

    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

      Attachments

        Issue Links

          Activity

            People

              stronk7 Eloy Lafuente (stronk7)
              stronk7 Eloy Lafuente (stronk7)
              Dan Poltawski Dan Poltawski
              Dan Poltawski Dan Poltawski
              Matteo Scaramuccia, Andrew Lyons, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                8/Jul/13