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

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

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: 3.0, 3.1
    • Fix Version/s: 3.0.1
    • Component/s: Installation
    • Labels:
    • Testing Instructions:
      Hide

      1) Check that all the commands in the description of the issue return 0 files.
      2) Check all upgrade scripts have the 3.0.0 comment before the return with:

       find . -name upgrade.php | xargs grep -B4 'return true;'
      

      • Usual exception : ./question/upgrade.php, ignore it. It's not a upgrade script.
      • 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) rock on.
      Show
      1) Check that all the commands in the description of the issue return 0 files. 2) Check all upgrade scripts have the 3.0.0 comment before the return with: find . -name upgrade.php | xargs grep -B4 'return true;' Usual exception : ./question/upgrade.php, ignore it. It's not a upgrade script. 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) rock on.
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_30_STABLE, MOODLE_31_STABLE
    • Fixed Branches:
      MOODLE_30_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 v3.0.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 30_STABLE and master branches, so they will allow quickly find where 3.0.0 started and act once we decide future requirements.

      The change can be performed globally with:

      #!/bin/bash
      export rel="3.0.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\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 v3.0.0 release upgrade'
      

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

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

      Command to detect if the lines have been added after a post-release upgrade step:

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

      Ciao

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              stronk7 Eloy Lafuente (stronk7)
              Reporter:
              stronk7 Eloy Lafuente (stronk7)
              Integrator:
              Dan Poltawski
              Tester:
              Rajesh Taneja
              Participants:
              Component watchers:
              Matteo Scaramuccia, Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                21/Dec/15