Merge branch 'MDL-46284-master' of git://github.com/andrewnicols/moodle
authorSam Hemelryk <sam@moodle.com>
Tue, 7 Oct 2014 03:28:50 +0000 (16:28 +1300)
committerSam Hemelryk <sam@moodle.com>
Tue, 7 Oct 2014 03:28:50 +0000 (16:28 +1300)
Conflicts:
lib/db/install.xml
lib/db/upgrade.php
version.php

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

index cb964b6,ae46c3b..97d8e42
mode 100755,100644..100755
@@@ -1,5 -1,5 +1,5 @@@
  <?xml version="1.0" encoding="UTF-8" ?>
- <XMLDB PATH="lib/db" VERSION="20140921" COMMENT="XMLDB file for core Moodle tables"
 -<XMLDB PATH="lib/db" VERSION="20141002" COMMENT="XMLDB file for core Moodle tables"
++<XMLDB PATH="lib/db" VERSION="20141007" COMMENT="XMLDB file for core Moodle tables"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:noNamespaceSchemaLocation="../../lib/xmldb/xmldb.xsd"
  >
@@@ -3837,92 -3837,30 +3837,117 @@@ function xmldb_main_upgrade($oldversion
          upgrade_main_savepoint(true, 2014100100.00);
      }
  
 -    if ($oldversion < 2014100200.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, 2014100200.01);
++        upgrade_main_savepoint(true, 2014100700.00);
+     }
      return true;
  }
diff --cc version.php
@@@ -29,7 -29,7 +29,7 @@@
  
  defined('MOODLE_INTERNAL') || die();
  
- $version  = 2014100600.04;              // YYYYMMDD      = weekly release date of this DEV branch.
 -$version  = 2014100200.01;              // YYYYMMDD      = weekly release date of this DEV branch.
++$version  = 2014100700.00;              // YYYYMMDD      = weekly release date of this DEV branch.
                                          //         RR    = release increments - 00 in DEV branches.
                                          //           .XX = incremental changes.