Merge branch 'wip-MDL-29332-master-3' of git://github.com/marinaglancy/moodle
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Mon, 19 Sep 2016 09:51:08 +0000 (11:51 +0200)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Mon, 19 Sep 2016 09:51:08 +0000 (11:51 +0200)
1  2 
lib/db/upgrade.php
lib/upgrade.txt
version.php

@@@ -2177,51 -2177,20 +2177,66 @@@ function xmldb_main_upgrade($oldversion
          upgrade_main_savepoint(true, 2016082200.00);
      }
  
 -    if ($oldversion < 2016091501.00) {
 +    if ($oldversion < 2016091900.00) {
 +
 +        // Removing the themes from core.
 +        $themes = array('base', 'canvas');
 +
 +        foreach ($themes as $key => $theme) {
 +            if (check_dir_exists($CFG->dirroot . '/theme/' . $theme, false)) {
 +                // Ignore the themes that have been re-downloaded.
 +                unset($themes[$key]);
 +            }
 +        }
 +
 +        if (!empty($themes)) {
 +
 +            list($insql, $inparams) = $DB->get_in_or_equal($themes, SQL_PARAMS_NAMED);
 +
 +            // Replace the theme usage.
 +            $DB->set_field_select('course', 'theme', 'clean', "theme $insql", $inparams);
 +            $DB->set_field_select('course_categories', 'theme', 'clean', "theme $insql", $inparams);
 +            $DB->set_field_select('user', 'theme', 'clean', "theme $insql", $inparams);
 +            $DB->set_field_select('mnet_host', 'theme', 'clean', "theme $insql", $inparams);
 +
 +            // Replace the theme configs.
 +            if (in_array(get_config('core', 'theme'), $themes)) {
 +                set_config('theme', 'clean');
 +            }
 +            if (in_array(get_config('core', 'thememobile'), $themes)) {
 +                set_config('thememobile', 'clean');
 +            }
 +            if (in_array(get_config('core', 'themelegacy'), $themes)) {
 +                set_config('themelegacy', 'clean');
 +            }
 +            if (in_array(get_config('core', 'themetablet'), $themes)) {
 +                set_config('themetablet', 'clean');
 +            }
 +
 +            // Hacky emulation of plugin uninstallation.
 +            foreach ($themes as $theme) {
 +                unset_all_config_for_plugin('theme_' . $theme);
 +            }
 +        }
 +
 +        // Main savepoint reached.
 +        upgrade_main_savepoint(true, 2016091900.00);
 +    }
 +
++    if ($oldversion < 2016091900.02) {
+         // Define index attemptstepid-name (unique) to be dropped from question_attempt_step_data.
+         $table = new xmldb_table('question_attempt_step_data');
+         $index = new xmldb_index('attemptstepid-name', XMLDB_INDEX_UNIQUE, array('attemptstepid', 'name'));
+         // Conditionally launch drop index attemptstepid-name.
+         if ($dbman->index_exists($table, $index)) {
+             $dbman->drop_index($table, $index);
+         }
+         // Main savepoint reached.
 -        upgrade_main_savepoint(true, 2016091501.00);
++        upgrade_main_savepoint(true, 2016091900.02);
+     }
      return true;
  }
diff --cc lib/upgrade.txt
Simple merge
diff --cc version.php
@@@ -29,7 -29,7 +29,7 @@@
  
  defined('MOODLE_INTERNAL') || die();
  
- $version  = 2016091900.01;              // YYYYMMDD      = weekly release date of this DEV branch.
 -$version  = 2016091501.00;              // YYYYMMDD      = weekly release date of this DEV branch.
++$version  = 2016091900.02;              // YYYYMMDD      = weekly release date of this DEV branch.
                                          //         RR    = release increments - 00 in DEV branches.
                                          //           .XX = incremental changes.