Merge branch 'wip-MDL-36014-master' of git://github.com/marinaglancy/moodle
authorDamyon Wiese <damyon@moodle.com>
Tue, 7 Oct 2014 04:34:34 +0000 (12:34 +0800)
committerDamyon Wiese <damyon@moodle.com>
Tue, 7 Oct 2014 04:34:34 +0000 (12:34 +0800)
Conflicts:
lib/db/install.xml
lib/db/upgrade.php
version.php

1  2 
lib/db/install.xml
lib/db/upgrade.php
lib/upgrade.txt
version.php

index 97d8e42,73be6a5..4305be4
mode 100755,100644..100755
@@@ -3837,117 -3837,20 +3837,132 @@@ function xmldb_main_upgrade($oldversion
          upgrade_main_savepoint(true, 2014100100.00);
      }
  
 -    if ($oldversion < 2014100300.01) {
 +    if ($oldversion < 2014100600.01) {
 +        // Define field aggregationstatus to be added to grade_grades.
 +        $table = new xmldb_table('grade_grades');
 +        $field = new xmldb_field('aggregationstatus', XMLDB_TYPE_CHAR, '10', null, XMLDB_NOTNULL, null, 'unknown', 'timemodified');
 +
 +        // Conditionally launch add field aggregationstatus.
 +        if (!$dbman->field_exists($table, $field)) {
 +            $dbman->add_field($table, $field);
 +        }
 +
 +        $field = new xmldb_field('aggregationweight', XMLDB_TYPE_NUMBER, '10, 5', null, null, null, null, 'aggregationstatus');
 +
 +        // Conditionally launch add field aggregationweight.
 +        if (!$dbman->field_exists($table, $field)) {
 +            $dbman->add_field($table, $field);
 +        }
 +
 +        // Define field aggregationcoef2 to be added to grade_items.
 +        $table = new xmldb_table('grade_items');
 +        $field = new xmldb_field('aggregationcoef2', XMLDB_TYPE_NUMBER, '10, 5', null, XMLDB_NOTNULL, null, '0', 'aggregationcoef');
 +
 +        // Conditionally launch add field aggregationcoef2.
 +        if (!$dbman->field_exists($table, $field)) {
 +            $dbman->add_field($table, $field);
 +        }
 +
 +        $field = new xmldb_field('weightoverride', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '0', 'needsupdate');
 +
 +        // Conditionally launch add field weightoverride.
 +        if (!$dbman->field_exists($table, $field)) {
 +            $dbman->add_field($table, $field);
 +        }
 +
 +        // Main savepoint reached.
 +        upgrade_main_savepoint(true, 2014100600.01);
 +    }
 +
 +    if ($oldversion < 2014100600.02) {
 +
 +        // Define field aggregationcoef2 to be added to grade_items_history.
 +        $table = new xmldb_table('grade_items_history');
 +        $field = new xmldb_field('aggregationcoef2', XMLDB_TYPE_NUMBER, '10, 5', null, XMLDB_NOTNULL, null, '0', 'aggregationcoef');
 +
 +        // Conditionally launch add field aggregationcoef2.
 +        if (!$dbman->field_exists($table, $field)) {
 +            $dbman->add_field($table, $field);
 +        }
 +
 +        // Main savepoint reached.
 +        upgrade_main_savepoint(true, 2014100600.02);
 +    }
 +
 +    if ($oldversion < 2014100600.03) {
 +
 +        // Define field weightoverride to be added to grade_items_history.
 +        $table = new xmldb_table('grade_items_history');
 +        $field = new xmldb_field('weightoverride', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '0', 'decimals');
 +
 +        // Conditionally launch add field weightoverride.
 +        if (!$dbman->field_exists($table, $field)) {
 +            $dbman->add_field($table, $field);
 +        }
 +
 +        // Main savepoint reached.
 +        upgrade_main_savepoint(true, 2014100600.03);
 +    }
 +    if ($oldversion < 2014100600.04) {
 +        // Set flags so we can display a notice on all courses that might
 +        // be affected by the uprade to natural aggregation.
 +        if (!get_config('grades_sumofgrades_upgrade_flagged', 'core')) {
 +            // 13 == SUM_OF_GRADES.
 +            $sql = 'SELECT DISTINCT courseid
 +                      FROM {grade_categories}
 +                     WHERE aggregation = ?';
 +            $courses = $DB->get_records_sql($sql, array(13));
 +
 +            foreach ($courses as $course) {
 +                set_config('show_sumofgrades_upgrade_' . $course->courseid, 1);
 +            }
 +
 +            set_config('grades_sumofgrades_upgrade_flagged', 1);
 +        }
 +
 +        // Main savepoint reached.
 +        upgrade_main_savepoint(true, 2014100600.04);
 +    }
 +
 +    if ($oldversion < 2014100700.00) {
 +
 +        // Define table messageinbound_messagelist to be created.
 +        $table = new xmldb_table('messageinbound_messagelist');
 +
 +        // Adding fields to table messageinbound_messagelist.
 +        $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
 +        $table->add_field('messageid', XMLDB_TYPE_TEXT, null, null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('userid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('address', XMLDB_TYPE_TEXT, null, null, XMLDB_NOTNULL, null, null);
 +        $table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
 +
 +        // Adding keys to table messageinbound_messagelist.
 +        $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
 +        $table->add_key('userid', XMLDB_KEY_FOREIGN, array('userid'), 'user', array('id'));
 +
 +        // Conditionally launch create table for messageinbound_messagelist.
 +        if (!$dbman->table_exists($table)) {
 +            $dbman->create_table($table);
 +        }
 +
 +        // Main savepoint reached.
 +        upgrade_main_savepoint(true, 2014100700.00);
 +    }
 +
++    if ($oldversion < 2014100700.01) {
+         // Define field visible to be added to cohort.
+         $table = new xmldb_table('cohort');
+         $field = new xmldb_field('visible', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '1', 'descriptionformat');
+         // Conditionally launch add field visible.
+         if (!$dbman->field_exists($table, $field)) {
+             $dbman->add_field($table, $field);
+         }
+         // Main savepoint reached.
 -        upgrade_main_savepoint(true, 2014100300.01);
++        upgrade_main_savepoint(true, 2014100700.01);
+     }
      return true;
  }
diff --cc lib/upgrade.txt
Simple merge
diff --cc version.php
@@@ -29,7 -29,7 +29,7 @@@
  
  defined('MOODLE_INTERNAL') || die();
  
- $version  = 2014100700.00;              // YYYYMMDD      = weekly release date of this DEV branch.
 -$version  = 2014100300.01;              // YYYYMMDD      = weekly release date of this DEV branch.
++$version  = 2014100700.01;              // YYYYMMDD      = weekly release date of this DEV branch.
                                          //         RR    = release increments - 00 in DEV branches.
                                          //           .XX = incremental changes.