Merge branch 'MDL-50385-master' of git://github.com/merrill-oakland/moodle
authorDavid Monllao <davidm@moodle.com>
Mon, 15 Feb 2016 22:47:27 +0000 (06:47 +0800)
committerDavid Monllao <davidm@moodle.com>
Mon, 15 Feb 2016 22:47:27 +0000 (06:47 +0800)
Conflicts:
lib/db/upgrade.php
version.php

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

@@@ -1381,23 -4916,22 +1381,40 @@@ function xmldb_main_upgrade($oldversion
          upgrade_main_savepoint(true, 2016020201.00);
      }
  
 -    if ($oldversion < 2016021100.01) {
 +    if ($oldversion < 2016021500.00) {
 +        $root = $CFG->tempdir . '/download';
 +        if (is_dir($root)) {
 +            // Fetch each repository type - include all repos, not just enabled.
 +            $repositories = $DB->get_records('repository', array(), '', 'type');
 +
 +            foreach ($repositories as $id => $repository) {
 +                $directory = $root . '/repository_' . $repository->type;
 +                if (is_dir($directory)) {
 +                    fulldelete($directory);
 +                }
 +            }
 +        }
 +
 +        // Main savepoint reached.
 +        upgrade_main_savepoint(true, 2016021500.00);
 +    }
 +
++    if ($oldversion < 2016021501.00) {
+         // This could take a long time. Unfortunately, no way to know how long, and no way to do progress, so setting for 1 hour.
+         upgrade_set_timeout(3600);
+         // Define index userid-itemid (not unique) to be added to grade_grades_history.
+         $table = new xmldb_table('grade_grades_history');
+         $index = new xmldb_index('userid-itemid-timemodified', XMLDB_INDEX_NOTUNIQUE, array('userid', 'itemid', 'timemodified'));
+         // Conditionally launch add index userid-itemid.
+         if (!$dbman->index_exists($table, $index)) {
+             $dbman->add_index($table, $index);
+         }
+         // Main savepoint reached.
 -        upgrade_main_savepoint(true, 2016021100.01);
++        upgrade_main_savepoint(true, 2016021501.00);
+     }
      return true;
  }
diff --cc version.php
@@@ -29,7 -29,7 +29,7 @@@
  
  defined('MOODLE_INTERNAL') || die();
  
- $version  = 2016021500.00;              // YYYYMMDD      = weekly release date of this DEV branch.
 -$version  = 2016021100.01;              // YYYYMMDD      = weekly release date of this DEV branch.
++$version  = 2016021501.00;              // YYYYMMDD      = weekly release date of this DEV branch.
                                          //         RR    = release increments - 00 in DEV branches.
                                          //           .XX = incremental changes.