MDL-57432 upgrade: clean < 3.0.0 upgrade steps
This just deletes all the upgrade steps previous to 3.0.0. Some small adjustments, like adding missing MOODLE_INTERNAL or tweaking globals can also be applied when needed. Also includes an upgrade step to prevent upgrading from any version < 2015111600 (v3.0.0) as anti-cheating measure. Next commit will get rid of/deprecate all the upgradelib functions not used anymore in codebase.
This commit is contained in:
committed by
Dan Poltawski
parent
d18f16032c
commit
29af7b0b4c
@@ -29,15 +29,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_tool_customlang_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -33,15 +33,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_tool_log_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -27,15 +27,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_logstore_database_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -25,33 +25,7 @@
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
function xmldb_logstore_standard_upgrade($oldversion) {
|
||||
global $CFG, $DB;
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2016041200) {
|
||||
// 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 key contextid (foreign) to be added to logstore_standard_log.
|
||||
$table = new xmldb_table('logstore_standard_log');
|
||||
$key = new xmldb_key('contextid', XMLDB_KEY_FOREIGN, array('contextid'), 'context', array('id'));
|
||||
|
||||
// Launch add key contextid.
|
||||
$dbman->add_key($table, $key);
|
||||
|
||||
// Standard savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2016041200, 'logstore', 'standard');
|
||||
}
|
||||
global $CFG;
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
@@ -31,34 +31,10 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @return bool always true
|
||||
*/
|
||||
function xmldb_tool_monitor_upgrade($oldversion) {
|
||||
global $DB;
|
||||
global $CFG, $DB;
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
if ($oldversion < 2014102000) {
|
||||
|
||||
// Define field lastnotificationsent to be added to tool_monitor_subscriptions.
|
||||
$table = new xmldb_table('tool_monitor_subscriptions');
|
||||
$field = new xmldb_field('lastnotificationsent', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0', 'timecreated');
|
||||
|
||||
// Conditionally launch add field lastnotificationsent.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Monitor savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2014102000, 'tool', 'monitor');
|
||||
}
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
+1
-22
@@ -30,28 +30,7 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @return bool result
|
||||
*/
|
||||
function xmldb_auth_cas_upgrade($oldversion) {
|
||||
global $CFG, $DB;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2014111001) {
|
||||
// From now on the default LDAP objectClass setting for AD has been changed, from 'user' to '(samaccounttype=805306368)'.
|
||||
if (is_enabled_auth('cas')
|
||||
&& ($DB->get_field('config_plugins', 'value', array('name' => 'user_type', 'plugin' => 'auth/cas')) === 'ad')
|
||||
&& ($DB->get_field('config_plugins', 'value', array('name' => 'objectclass', 'plugin' => 'auth/cas')) === '')) {
|
||||
// Save the backwards-compatible default setting.
|
||||
set_config('objectclass', 'user', 'auth/cas');
|
||||
}
|
||||
|
||||
upgrade_plugin_savepoint(true, 2014111001, 'auth', 'cas');
|
||||
}
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
global $CFG;
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
@@ -30,28 +30,7 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @return bool result
|
||||
*/
|
||||
function xmldb_auth_ldap_upgrade($oldversion) {
|
||||
global $CFG, $DB;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2014111001) {
|
||||
// From now on the default LDAP objectClass setting for AD has been changed, from 'user' to '(samaccounttype=805306368)'.
|
||||
if (is_enabled_auth('ldap')
|
||||
&& ($DB->get_field('config_plugins', 'value', array('name' => 'user_type', 'plugin' => 'auth/ldap')) === 'ad')
|
||||
&& ($DB->get_field('config_plugins', 'value', array('name' => 'objectclass', 'plugin' => 'auth/ldap')) === '')) {
|
||||
// Save the backwards-compatible default setting.
|
||||
set_config('objectclass', 'user', 'auth/ldap');
|
||||
}
|
||||
|
||||
upgrade_plugin_savepoint(true, 2014111001, 'auth', 'ldap');
|
||||
}
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
global $CFG;
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
@@ -30,16 +30,7 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @return bool result
|
||||
*/
|
||||
function xmldb_auth_manual_upgrade($oldversion) {
|
||||
global $CFG, $DB;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
global $CFG;
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
@@ -30,16 +30,7 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @return bool result
|
||||
*/
|
||||
function xmldb_auth_mnet_upgrade($oldversion) {
|
||||
global $CFG, $DB;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
global $CFG;
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
@@ -43,44 +43,7 @@
|
||||
* @param object $block
|
||||
*/
|
||||
function xmldb_block_badges_upgrade($oldversion, $block) {
|
||||
global $DB;
|
||||
|
||||
if ($oldversion < 2014062600) {
|
||||
// Add this block the default blocks on /my.
|
||||
$blockname = 'badges';
|
||||
|
||||
// Do not try to add the block if we cannot find the default my_pages entry.
|
||||
// Private => 1 refers to MY_PAGE_PRIVATE.
|
||||
if ($systempage = $DB->get_record('my_pages', array('userid' => null, 'private' => 1))) {
|
||||
$page = new moodle_page();
|
||||
$page->set_context(context_system::instance());
|
||||
|
||||
// Check to see if this block is already on the default /my page.
|
||||
$criteria = array(
|
||||
'blockname' => $blockname,
|
||||
'parentcontextid' => $page->context->id,
|
||||
'pagetypepattern' => 'my-index',
|
||||
'subpagepattern' => $systempage->id,
|
||||
);
|
||||
|
||||
if (!$DB->record_exists('block_instances', $criteria)) {
|
||||
// Add the block to the default /my.
|
||||
$page->blocks->add_region(BLOCK_POS_RIGHT);
|
||||
$page->blocks->add_block($blockname, BLOCK_POS_RIGHT, 0, false, 'my-index', $systempage->id);
|
||||
}
|
||||
}
|
||||
|
||||
upgrade_block_savepoint(true, 2014062600, $blockname);
|
||||
}
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
global $CFG;
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
@@ -43,44 +43,7 @@
|
||||
* @param object $block
|
||||
*/
|
||||
function xmldb_block_calendar_month_upgrade($oldversion, $block) {
|
||||
global $DB;
|
||||
|
||||
if ($oldversion < 2014062600) {
|
||||
// Add this block the default blocks on /my.
|
||||
$blockname = 'calendar_month';
|
||||
|
||||
// Do not try to add the block if we cannot find the default my_pages entry.
|
||||
// Private => 1 refers to MY_PAGE_PRIVATE.
|
||||
if ($systempage = $DB->get_record('my_pages', array('userid' => null, 'private' => 1))) {
|
||||
$page = new moodle_page();
|
||||
$page->set_context(context_system::instance());
|
||||
|
||||
// Check to see if this block is already on the default /my page.
|
||||
$criteria = array(
|
||||
'blockname' => $blockname,
|
||||
'parentcontextid' => $page->context->id,
|
||||
'pagetypepattern' => 'my-index',
|
||||
'subpagepattern' => $systempage->id,
|
||||
);
|
||||
|
||||
if (!$DB->record_exists('block_instances', $criteria)) {
|
||||
// Add the block to the default /my.
|
||||
$page->blocks->add_region(BLOCK_POS_RIGHT);
|
||||
$page->blocks->add_block($blockname, BLOCK_POS_RIGHT, 0, false, 'my-index', $systempage->id);
|
||||
}
|
||||
}
|
||||
|
||||
upgrade_block_savepoint(true, 2014062600, $blockname);
|
||||
}
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
global $CFG;
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
@@ -43,44 +43,7 @@
|
||||
* @param object $block
|
||||
*/
|
||||
function xmldb_block_calendar_upcoming_upgrade($oldversion, $block) {
|
||||
global $DB;
|
||||
|
||||
if ($oldversion < 2014062600) {
|
||||
// Add this block the default blocks on /my.
|
||||
$blockname = 'calendar_upcoming';
|
||||
|
||||
// Do not try to add the block if we cannot find the default my_pages entry.
|
||||
// Private => 1 refers to MY_PAGE_PRIVATE.
|
||||
if ($systempage = $DB->get_record('my_pages', array('userid' => null, 'private' => 1))) {
|
||||
$page = new moodle_page();
|
||||
$page->set_context(context_system::instance());
|
||||
|
||||
// Check to see if this block is already on the default /my page.
|
||||
$criteria = array(
|
||||
'blockname' => $blockname,
|
||||
'parentcontextid' => $page->context->id,
|
||||
'pagetypepattern' => 'my-index',
|
||||
'subpagepattern' => $systempage->id,
|
||||
);
|
||||
|
||||
if (!$DB->record_exists('block_instances', $criteria)) {
|
||||
// Add the block to the default /my.
|
||||
$page->blocks->add_region(BLOCK_POS_RIGHT);
|
||||
$page->blocks->add_block($blockname, BLOCK_POS_RIGHT, 0, false, 'my-index', $systempage->id);
|
||||
}
|
||||
}
|
||||
|
||||
upgrade_block_savepoint(true, 2014062600, $blockname);
|
||||
}
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
global $CFG;
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
@@ -46,15 +46,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_block_community_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -48,15 +48,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_block_completionstatus_upgrade($oldversion, $block) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -48,15 +48,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_block_course_summary_upgrade($oldversion, $block) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -33,15 +33,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_block_html_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -55,15 +55,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_block_navigation_upgrade($oldversion, $block) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -43,69 +43,7 @@
|
||||
* @param object $block
|
||||
*/
|
||||
function xmldb_block_quiz_results_upgrade($oldversion, $block) {
|
||||
global $DB, $CFG;
|
||||
|
||||
if ($oldversion < 2015022200) {
|
||||
// Only migrate if the block_activity_results is installed.
|
||||
if (is_dir($CFG->dirroot . '/blocks/activity_results')) {
|
||||
|
||||
// Migrate all instances of block_quiz_results to block_activity_results.
|
||||
$records = $DB->get_records('block_instances', array('blockname' => 'quiz_results'));
|
||||
foreach ($records as $record) {
|
||||
$configdata = '';
|
||||
|
||||
// The block was configured.
|
||||
if (!empty($record->configdata)) {
|
||||
|
||||
$config = unserialize(base64_decode($record->configdata));
|
||||
$config->activityparent = 'quiz';
|
||||
$config->activityparentid = isset($config->quizid) ? $config->quizid : 0;
|
||||
$config->gradeformat = isset($config->gradeformat) ? $config->gradeformat : 1;
|
||||
|
||||
// Set the decimal valuue as appropriate.
|
||||
if ($config->gradeformat == 1) {
|
||||
// This block is using percentages, do not display any decimal places.
|
||||
$config->decimalpoints = 0;
|
||||
} else {
|
||||
// Get the decimal value from the corresponding quiz.
|
||||
$config->decimalpoints = $DB->get_field('quiz', 'decimalpoints', array('id' => $config->activityparentid));
|
||||
}
|
||||
|
||||
// Get the grade_items record to set the activitygradeitemid.
|
||||
$info = $DB->get_record('grade_items',
|
||||
array('iteminstance' => $config->activityparentid, 'itemmodule' => $config->activityparent));
|
||||
$config->activitygradeitemid = 0;
|
||||
if ($info) {
|
||||
$config->activitygradeitemid = $info->id;
|
||||
}
|
||||
|
||||
unset($config->quizid);
|
||||
$configdata = base64_encode(serialize($config));
|
||||
}
|
||||
|
||||
// Save the new configuration and update the record.
|
||||
$record->configdata = $configdata;
|
||||
$record->blockname = 'activity_results';
|
||||
$DB->update_record('block_instances', $record);
|
||||
}
|
||||
|
||||
// Disable the Quiz_results block.
|
||||
if ($block = $DB->get_record("block", array("name" => "quiz_results"))) {
|
||||
$DB->set_field("block", "visible", "0", array("id" => $block->id));
|
||||
}
|
||||
|
||||
}
|
||||
upgrade_block_savepoint(true, 2015022200, 'quiz_results');
|
||||
}
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
global $CFG;
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
@@ -117,4 +55,4 @@ function xmldb_block_quiz_results_upgrade($oldversion, $block) {
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,15 +47,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_block_recent_activity_upgrade($oldversion, $block) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -31,27 +31,7 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @return boolean
|
||||
*/
|
||||
function xmldb_block_rss_client_upgrade($oldversion) {
|
||||
global $DB;
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
if ($oldversion < 2015071700) {
|
||||
// Support for skipping RSS feeds for a while when they fail.
|
||||
$table = new xmldb_table('block_rss_client');
|
||||
// How many seconds we are currently ignoring this RSS feed for (due to an error).
|
||||
$field = new xmldb_field('skiptime', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0', 'url');
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
// When to next update this RSS feed.
|
||||
$field = new xmldb_field('skipuntil', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0', 'skiptime');
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
upgrade_block_savepoint(true, 2015071700, 'rss_client');
|
||||
}
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
global $CFG;
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
@@ -49,15 +49,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_block_section_links_upgrade($oldversion, $block) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -48,15 +48,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_block_selfcompletion_upgrade($oldversion, $block) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -55,15 +55,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_block_settings_upgrade($oldversion, $block) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -27,15 +27,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_enrol_database_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -27,15 +27,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_enrol_flatfile_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -27,15 +27,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_enrol_guest_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -33,15 +33,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_enrol_imsenterprise_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -27,21 +27,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_enrol_manual_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2015091500) {
|
||||
// We keep today as default enrolment start time on upgrades.
|
||||
set_config('enrolstart', 3, 'enrol_manual');
|
||||
upgrade_plugin_savepoint(true, 2015091500, 'enrol', 'manual');
|
||||
}
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -27,15 +27,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_enrol_mnet_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -45,15 +45,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_enrol_paypal_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -25,22 +25,12 @@
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
function xmldb_enrol_self_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
global $CFG, $DB;
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2016052301) {
|
||||
global $DB;
|
||||
// Get roles with manager archetype.
|
||||
$managerroles = get_archetype_roles('manager');
|
||||
if (!empty($managerroles)) {
|
||||
|
||||
@@ -29,90 +29,10 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @return bool result
|
||||
*/
|
||||
function xmldb_filter_mathjaxloader_upgrade($oldversion) {
|
||||
global $CFG, $DB;
|
||||
global $CFG;
|
||||
|
||||
require_once($CFG->dirroot . '/filter/mathjaxloader/db/upgradelib.php');
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
if ($oldversion < 2014081100) {
|
||||
|
||||
$sslcdnurl = get_config('filter_mathjaxloader', 'httpsurl');
|
||||
if ($sslcdnurl === "https://c328740.ssl.cf1.rackcdn.com/mathjax/2.3-latest/MathJax.js") {
|
||||
set_config('httpsurl', 'https://cdn.mathjax.org/mathjax/2.3-latest/MathJax.js', 'filter_mathjaxloader');
|
||||
}
|
||||
|
||||
upgrade_plugin_savepoint(true, 2014081100, 'filter', 'mathjaxloader');
|
||||
}
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2015021200) {
|
||||
|
||||
$httpurl = get_config('filter_mathjaxloader', 'httpurl');
|
||||
// Don't change the config if it has been manually changed to something besides the default setting value.
|
||||
if ($httpurl === "http://cdn.mathjax.org/mathjax/2.3-latest/MathJax.js") {
|
||||
set_config('httpurl', 'http://cdn.mathjax.org/mathjax/2.5-latest/MathJax.js', 'filter_mathjaxloader');
|
||||
}
|
||||
|
||||
$httpsurl = get_config('filter_mathjaxloader', 'httpsurl');
|
||||
// Don't change the config if it has been manually changed to something besides the default setting value.
|
||||
if ($httpsurl === "https://cdn.mathjax.org/mathjax/2.3-latest/MathJax.js") {
|
||||
set_config('httpsurl', 'https://cdn.mathjax.org/mathjax/2.5-latest/MathJax.js', 'filter_mathjaxloader');
|
||||
}
|
||||
|
||||
upgrade_plugin_savepoint(true, 2015021200, 'filter', 'mathjaxloader');
|
||||
}
|
||||
|
||||
if ($oldversion < 2015021700) {
|
||||
|
||||
$oldconfig = get_config('filter_mathjaxloader', 'mathjaxconfig');
|
||||
$olddefault = 'MathJax.Hub.Config({
|
||||
config: ["MMLorHTML.js", "Safe.js"],
|
||||
jax: ["input/TeX","input/MathML","output/HTML-CSS","output/NativeMML"],
|
||||
extensions: ["tex2jax.js","mml2jax.js","MathMenu.js","MathZoom.js"],
|
||||
TeX: {
|
||||
extensions: ["AMSmath.js","AMSsymbols.js","noErrors.js","noUndefined.js"]
|
||||
},
|
||||
menuSettings: {
|
||||
zoom: "Double-Click",
|
||||
mpContext: true,
|
||||
mpMouse: true
|
||||
},
|
||||
errorSettings: { message: ["!"] },
|
||||
skipStartupTypeset: true,
|
||||
messageStyle: "none"
|
||||
});
|
||||
';
|
||||
$newdefault = '
|
||||
MathJax.Hub.Config({
|
||||
config: ["Accessible.js", "Safe.js"],
|
||||
errorSettings: { message: ["!"] },
|
||||
skipStartupTypeset: true,
|
||||
messageStyle: "none"
|
||||
});
|
||||
';
|
||||
|
||||
// Ignore white space changes.
|
||||
$oldconfig = trim(preg_replace('/\s+/', ' ', $oldconfig));
|
||||
$olddefault = trim(preg_replace('/\s+/', ' ', $olddefault));
|
||||
|
||||
// Update the default config for mathjax only if it has not been customised.
|
||||
|
||||
if ($oldconfig == $olddefault) {
|
||||
set_config('mathjaxconfig', $newdefault, 'filter_mathjaxloader');
|
||||
}
|
||||
|
||||
upgrade_plugin_savepoint(true, 2015021700, 'filter', 'mathjaxloader');
|
||||
}
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2016032200) {
|
||||
|
||||
$httpurl = get_config('filter_mathjaxloader', 'httpurl');
|
||||
|
||||
@@ -32,15 +32,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_filter_mediaplugin_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -32,15 +32,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_filter_tex_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -33,15 +33,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_gradingform_rubric_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -27,23 +27,7 @@
|
||||
* @return bool result
|
||||
*/
|
||||
function xmldb_gradereport_user_upgrade($oldversion) {
|
||||
|
||||
if ($oldversion < 2014101500) {
|
||||
// Need to always show weight and contribution to course total.
|
||||
set_config('grade_report_user_showweight', 1);
|
||||
|
||||
// User savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2014101500, 'gradereport', 'user');
|
||||
}
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
global $CFG;
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
+4
-977
@@ -92,988 +92,15 @@ function xmldb_main_upgrade($oldversion) {
|
||||
$dbman = $DB->get_manager(); // Loads ddl manager and xmldb classes.
|
||||
|
||||
// Always keep this upgrade step with version being the minimum
|
||||
// allowed version to upgrade from (v2.7.0 right now).
|
||||
if ($oldversion < 2014051200) {
|
||||
// allowed version to upgrade from (v3.0.0 right now).
|
||||
if ($oldversion < 2015111600) {
|
||||
// Just in case somebody hacks upgrade scripts or env, we really can not continue.
|
||||
echo("You need to upgrade to 2.7.x or higher first!\n");
|
||||
echo("You need to upgrade to 3.0.x or higher first!\n");
|
||||
exit(1);
|
||||
// Note this savepoint is 100% unreachable, but needed to pass the upgrade checks.
|
||||
upgrade_main_savepoint(true, 2014051200);
|
||||
upgrade_main_savepoint(true, 2015111600);
|
||||
}
|
||||
|
||||
// MDL-32543 Make sure that the log table has correct length for action and url fields.
|
||||
if ($oldversion < 2014051200.02) {
|
||||
|
||||
$table = new xmldb_table('log');
|
||||
|
||||
$columns = $DB->get_columns('log');
|
||||
if ($columns['action']->max_length < 40) {
|
||||
$index1 = new xmldb_index('course-module-action', XMLDB_INDEX_NOTUNIQUE, array('course', 'module', 'action'));
|
||||
if ($dbman->index_exists($table, $index1)) {
|
||||
$dbman->drop_index($table, $index1);
|
||||
}
|
||||
$index2 = new xmldb_index('action', XMLDB_INDEX_NOTUNIQUE, array('action'));
|
||||
if ($dbman->index_exists($table, $index2)) {
|
||||
$dbman->drop_index($table, $index2);
|
||||
}
|
||||
$field = new xmldb_field('action', XMLDB_TYPE_CHAR, '40', null, XMLDB_NOTNULL, null, null, 'cmid');
|
||||
$dbman->change_field_precision($table, $field);
|
||||
$dbman->add_index($table, $index1);
|
||||
$dbman->add_index($table, $index2);
|
||||
}
|
||||
|
||||
if ($columns['url']->max_length < 100) {
|
||||
$field = new xmldb_field('url', XMLDB_TYPE_CHAR, '100', null, XMLDB_NOTNULL, null, null, 'action');
|
||||
$dbman->change_field_precision($table, $field);
|
||||
}
|
||||
|
||||
upgrade_main_savepoint(true, 2014051200.02);
|
||||
}
|
||||
|
||||
if ($oldversion < 2014060300.00) {
|
||||
$gspath = get_config('assignfeedback_editpdf', 'gspath');
|
||||
if ($gspath !== false) {
|
||||
set_config('pathtogs', $gspath);
|
||||
unset_config('gspath', 'assignfeedback_editpdf');
|
||||
}
|
||||
upgrade_main_savepoint(true, 2014060300.00);
|
||||
}
|
||||
|
||||
if ($oldversion < 2014061000.00) {
|
||||
// Fixing possible wrong MIME type for Publisher files.
|
||||
$filetypes = array('%.pub'=>'application/x-mspublisher');
|
||||
upgrade_mimetypes($filetypes);
|
||||
upgrade_main_savepoint(true, 2014061000.00);
|
||||
}
|
||||
|
||||
if ($oldversion < 2014062600.01) {
|
||||
// We only want to delete DragMath if the directory no longer exists. If the directory
|
||||
// is present then it means it has been restored, so do not perform the uninstall.
|
||||
if (!check_dir_exists($CFG->libdir . '/editor/tinymce/plugins/dragmath', false)) {
|
||||
// Purge DragMath plugin which is incompatible with GNU GPL license.
|
||||
unset_all_config_for_plugin('tinymce_dragmath');
|
||||
}
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2014062600.01);
|
||||
}
|
||||
|
||||
// Switch the order of the fields in the files_reference index, to improve the performance of search_references.
|
||||
if ($oldversion < 2014070100.00) {
|
||||
$table = new xmldb_table('files_reference');
|
||||
$index = new xmldb_index('uq_external_file', XMLDB_INDEX_UNIQUE, array('repositoryid', 'referencehash'));
|
||||
if ($dbman->index_exists($table, $index)) {
|
||||
$dbman->drop_index($table, $index);
|
||||
}
|
||||
upgrade_main_savepoint(true, 2014070100.00);
|
||||
}
|
||||
|
||||
if ($oldversion < 2014070101.00) {
|
||||
$table = new xmldb_table('files_reference');
|
||||
$index = new xmldb_index('uq_external_file', XMLDB_INDEX_UNIQUE, array('referencehash', 'repositoryid'));
|
||||
if (!$dbman->index_exists($table, $index)) {
|
||||
$dbman->add_index($table, $index);
|
||||
}
|
||||
upgrade_main_savepoint(true, 2014070101.00);
|
||||
}
|
||||
|
||||
if ($oldversion < 2014072400.01) {
|
||||
$table = new xmldb_table('user_devices');
|
||||
$oldindex = new xmldb_index('pushid-platform', XMLDB_KEY_UNIQUE, array('pushid', 'platform'));
|
||||
if ($dbman->index_exists($table, $oldindex)) {
|
||||
$key = new xmldb_key('pushid-platform', XMLDB_KEY_UNIQUE, array('pushid', 'platform'));
|
||||
$dbman->drop_key($table, $key);
|
||||
}
|
||||
upgrade_main_savepoint(true, 2014072400.01);
|
||||
}
|
||||
|
||||
if ($oldversion < 2014080801.00) {
|
||||
|
||||
// Define index behaviour (not unique) to be added to question_attempts.
|
||||
$table = new xmldb_table('question_attempts');
|
||||
$index = new xmldb_index('behaviour', XMLDB_INDEX_NOTUNIQUE, array('behaviour'));
|
||||
|
||||
// Conditionally launch add index behaviour.
|
||||
if (!$dbman->index_exists($table, $index)) {
|
||||
$dbman->add_index($table, $index);
|
||||
}
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2014080801.00);
|
||||
}
|
||||
|
||||
if ($oldversion < 2014082900.01) {
|
||||
// Fixing possible wrong MIME type for 7-zip and Rar files.
|
||||
$filetypes = array(
|
||||
'%.7z' => 'application/x-7z-compressed',
|
||||
'%.rar' => 'application/x-rar-compressed');
|
||||
upgrade_mimetypes($filetypes);
|
||||
upgrade_main_savepoint(true, 2014082900.01);
|
||||
}
|
||||
|
||||
if ($oldversion < 2014082900.02) {
|
||||
// Replace groupmembersonly usage with new availability system.
|
||||
$transaction = $DB->start_delegated_transaction();
|
||||
if ($CFG->enablegroupmembersonly) {
|
||||
// If it isn't already enabled, we need to enable availability.
|
||||
if (!$CFG->enableavailability) {
|
||||
set_config('enableavailability', 1);
|
||||
}
|
||||
|
||||
// Count all course-modules with groupmembersonly set (for progress
|
||||
// bar).
|
||||
$total = $DB->count_records('course_modules', array('groupmembersonly' => 1));
|
||||
$pbar = new progress_bar('upgradegroupmembersonly', 500, true);
|
||||
|
||||
// Get all these course-modules, one at a time.
|
||||
$rs = $DB->get_recordset('course_modules', array('groupmembersonly' => 1),
|
||||
'course, id');
|
||||
$i = 0;
|
||||
foreach ($rs as $cm) {
|
||||
// Calculate and set new availability value.
|
||||
$availability = upgrade_group_members_only($cm->groupingid, $cm->availability);
|
||||
$DB->set_field('course_modules', 'availability', $availability,
|
||||
array('id' => $cm->id));
|
||||
|
||||
// Update progress.
|
||||
$i++;
|
||||
$pbar->update($i, $total, "Upgrading groupmembersonly settings - $i/$total.");
|
||||
}
|
||||
$rs->close();
|
||||
}
|
||||
|
||||
// Define field groupmembersonly to be dropped from course_modules.
|
||||
$table = new xmldb_table('course_modules');
|
||||
$field = new xmldb_field('groupmembersonly');
|
||||
|
||||
// Conditionally launch drop field groupmembersonly.
|
||||
if ($dbman->field_exists($table, $field)) {
|
||||
$dbman->drop_field($table, $field);
|
||||
}
|
||||
|
||||
// Unset old config variable.
|
||||
unset_config('enablegroupmembersonly');
|
||||
$transaction->allow_commit();
|
||||
|
||||
upgrade_main_savepoint(true, 2014082900.02);
|
||||
}
|
||||
|
||||
if ($oldversion < 2014100100.00) {
|
||||
|
||||
// Define table messageinbound_handlers to be created.
|
||||
$table = new xmldb_table('messageinbound_handlers');
|
||||
|
||||
// Adding fields to table messageinbound_handlers.
|
||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
|
||||
$table->add_field('component', XMLDB_TYPE_CHAR, '100', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('classname', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('defaultexpiration', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '86400');
|
||||
$table->add_field('validateaddress', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '1');
|
||||
$table->add_field('enabled', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '0');
|
||||
|
||||
// Adding keys to table messageinbound_handlers.
|
||||
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
|
||||
$table->add_key('classname', XMLDB_KEY_UNIQUE, array('classname'));
|
||||
|
||||
// Conditionally launch create table for messageinbound_handlers.
|
||||
if (!$dbman->table_exists($table)) {
|
||||
$dbman->create_table($table);
|
||||
}
|
||||
|
||||
// Define table messageinbound_datakeys to be created.
|
||||
$table = new xmldb_table('messageinbound_datakeys');
|
||||
|
||||
// Adding fields to table messageinbound_datakeys.
|
||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
|
||||
$table->add_field('handler', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('datavalue', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('datakey', XMLDB_TYPE_CHAR, '64', null, null, null, null);
|
||||
$table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('expires', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
|
||||
|
||||
// Adding keys to table messageinbound_datakeys.
|
||||
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
|
||||
$table->add_key('handler_datavalue', XMLDB_KEY_UNIQUE, array('handler', 'datavalue'));
|
||||
$table->add_key('handler', XMLDB_KEY_FOREIGN, array('handler'), 'messageinbound_handlers', array('id'));
|
||||
|
||||
// Conditionally launch create table for messageinbound_datakeys.
|
||||
if (!$dbman->table_exists($table)) {
|
||||
$dbman->create_table($table);
|
||||
}
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2014100100.00);
|
||||
}
|
||||
|
||||
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 each of the grade items to needing an update so that when the user visits the grade reports the
|
||||
// figures will be updated.
|
||||
$DB->set_field('grade_items', 'needsupdate', 1, array('courseid' => $course->courseid));
|
||||
}
|
||||
|
||||
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, 2014100700.01);
|
||||
}
|
||||
|
||||
if ($oldversion < 2014100800.00) {
|
||||
// Remove qformat_learnwise (unless it has manually been added back).
|
||||
if (!file_exists($CFG->dirroot . '/question/format/learnwise/format.php')) {
|
||||
unset_all_config_for_plugin('qformat_learnwise');
|
||||
}
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2014100800.00);
|
||||
}
|
||||
|
||||
if ($oldversion < 2014101001.00) {
|
||||
// Some blocks added themselves to the my/ home page, but they did not declare the
|
||||
// subpage of the default my home page. While the upgrade script has been fixed, this
|
||||
// upgrade script will fix the data that was wrongly added.
|
||||
|
||||
// We only proceed if we can find the right entry from my_pages. Private => 1 refers to
|
||||
// the constant value MY_PAGE_PRIVATE.
|
||||
if ($systempage = $DB->get_record('my_pages', array('userid' => null, 'private' => 1))) {
|
||||
|
||||
// Select the blocks there could have been automatically added. showinsubcontexts is hardcoded to 0
|
||||
// because it is possible for administrators to have forced it on the my/ page by adding it to the
|
||||
// system directly rather than updating the default my/ page.
|
||||
$blocks = array('course_overview', 'private_files', 'online_users', 'badges', 'calendar_month', 'calendar_upcoming');
|
||||
list($blocksql, $blockparams) = $DB->get_in_or_equal($blocks, SQL_PARAMS_NAMED);
|
||||
$select = "parentcontextid = :contextid
|
||||
AND pagetypepattern = :page
|
||||
AND showinsubcontexts = 0
|
||||
AND subpagepattern IS NULL
|
||||
AND blockname $blocksql";
|
||||
$params = array(
|
||||
'contextid' => context_system::instance()->id,
|
||||
'page' => 'my-index'
|
||||
);
|
||||
$params = array_merge($params, $blockparams);
|
||||
|
||||
$DB->set_field_select(
|
||||
'block_instances',
|
||||
'subpagepattern',
|
||||
$systempage->id,
|
||||
$select,
|
||||
$params
|
||||
);
|
||||
}
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2014101001.00);
|
||||
}
|
||||
|
||||
if ($oldversion < 2014102000.00) {
|
||||
|
||||
// Define field aggregatesubcats to be dropped from grade_categories.
|
||||
$table = new xmldb_table('grade_categories');
|
||||
$field = new xmldb_field('aggregatesubcats');
|
||||
|
||||
// Conditionally launch drop field aggregatesubcats.
|
||||
if ($dbman->field_exists($table, $field)) {
|
||||
|
||||
$sql = 'SELECT DISTINCT courseid
|
||||
FROM {grade_categories}
|
||||
WHERE aggregatesubcats = ?';
|
||||
$courses = $DB->get_records_sql($sql, array(1));
|
||||
|
||||
foreach ($courses as $course) {
|
||||
set_config('show_aggregatesubcats_upgrade_' . $course->courseid, 1);
|
||||
// Set each of the grade items to needing an update so that when the user visits the grade reports the
|
||||
// figures will be updated.
|
||||
$DB->set_field('grade_items', 'needsupdate', 1, array('courseid' => $course->courseid));
|
||||
}
|
||||
|
||||
|
||||
$dbman->drop_field($table, $field);
|
||||
}
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2014102000.00);
|
||||
}
|
||||
|
||||
if ($oldversion < 2014110300.00) {
|
||||
// Run script restoring missing folder records for draft file areas.
|
||||
upgrade_fix_missing_root_folders_draft();
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2014110300.00);
|
||||
}
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2014111000.00) {
|
||||
// Coming from 2.7 or older, we need to flag the step minmaxgrade to be ignored.
|
||||
set_config('upgrade_minmaxgradestepignored', 1);
|
||||
// Coming from 2.7 or older, we need to flag the step for changing calculated grades to be regraded.
|
||||
set_config('upgrade_calculatedgradeitemsonlyregrade', 1);
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2014111000.00);
|
||||
}
|
||||
|
||||
if ($oldversion < 2014120100.00) {
|
||||
|
||||
// Define field sslverification to be added to mnet_host.
|
||||
$table = new xmldb_table('mnet_host');
|
||||
$field = new xmldb_field('sslverification', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '0', 'applicationid');
|
||||
|
||||
// Conditionally launch add field sslverification.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2014120100.00);
|
||||
}
|
||||
|
||||
if ($oldversion < 2014120101.00) {
|
||||
|
||||
// Define field component to be added to comments.
|
||||
$table = new xmldb_table('comments');
|
||||
$field = new xmldb_field('component', XMLDB_TYPE_CHAR, '255', null, null, null, null, 'contextid');
|
||||
|
||||
// Conditionally launch add field component.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2014120101.00);
|
||||
}
|
||||
|
||||
if ($oldversion < 2014120102.00) {
|
||||
|
||||
// Define table user_password_history to be created.
|
||||
$table = new xmldb_table('user_password_history');
|
||||
|
||||
// Adding fields to table user_password_history.
|
||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
|
||||
$table->add_field('userid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('hash', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
|
||||
// Adding keys to table user_password_history.
|
||||
$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 user_password_history.
|
||||
if (!$dbman->table_exists($table)) {
|
||||
$dbman->create_table($table);
|
||||
}
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2014120102.00);
|
||||
}
|
||||
|
||||
if ($oldversion < 2015010800.01) {
|
||||
|
||||
// Make sure the private files handler is not set to expire.
|
||||
$DB->set_field('messageinbound_handlers', 'defaultexpiration', 0,
|
||||
array('classname' => '\core\message\inbound\private_files_handler'));
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2015010800.01);
|
||||
|
||||
}
|
||||
|
||||
if ($oldversion < 2015012600.00) {
|
||||
|
||||
// If the site is using internal and external storage, or just external
|
||||
// storage, and the external path specified is empty we change the setting
|
||||
// to internal only. That is how the backup code is handling this
|
||||
// misconfiguration.
|
||||
$storage = (int) get_config('backup', 'backup_auto_storage');
|
||||
$folder = get_config('backup', 'backup_auto_destination');
|
||||
if ($storage !== 0 && empty($folder)) {
|
||||
set_config('backup_auto_storage', 0, 'backup');
|
||||
}
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2015012600.00);
|
||||
}
|
||||
|
||||
if ($oldversion < 2015012600.01) {
|
||||
|
||||
// Convert calendar_lookahead to nearest new value.
|
||||
$value = $DB->get_field('config', 'value', array('name' => 'calendar_lookahead'));
|
||||
if ($value > 90) {
|
||||
set_config('calendar_lookahead', '120');
|
||||
} else if ($value > 60 and $value < 90) {
|
||||
set_config('calendar_lookahead', '90');
|
||||
} else if ($value > 30 and $value < 60) {
|
||||
set_config('calendar_lookahead', '60');
|
||||
} else if ($value > 21 and $value < 30) {
|
||||
set_config('calendar_lookahead', '30');
|
||||
} else if ($value > 14 and $value < 21) {
|
||||
set_config('calendar_lookahead', '21');
|
||||
} else if ($value > 7 and $value < 14) {
|
||||
set_config('calendar_lookahead', '14');
|
||||
}
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2015012600.01);
|
||||
}
|
||||
|
||||
if ($oldversion < 2015021100.00) {
|
||||
|
||||
// Define field timemodified to be added to registration_hubs.
|
||||
$table = new xmldb_table('registration_hubs');
|
||||
$field = new xmldb_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0', 'secret');
|
||||
|
||||
// Conditionally launch add field timemodified.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2015021100.00);
|
||||
}
|
||||
|
||||
if ($oldversion < 2015022401.00) {
|
||||
|
||||
// Define index useridfromto (not unique) to be added to message.
|
||||
$table = new xmldb_table('message');
|
||||
$index = new xmldb_index('useridfromto', XMLDB_INDEX_NOTUNIQUE, array('useridfrom', 'useridto'));
|
||||
|
||||
// Conditionally launch add index useridfromto.
|
||||
if (!$dbman->index_exists($table, $index)) {
|
||||
$dbman->add_index($table, $index);
|
||||
}
|
||||
|
||||
// Define index useridfromto (not unique) to be added to message_read.
|
||||
$table = new xmldb_table('message_read');
|
||||
$index = new xmldb_index('useridfromto', XMLDB_INDEX_NOTUNIQUE, array('useridfrom', 'useridto'));
|
||||
|
||||
// Conditionally launch add index useridfromto.
|
||||
if (!$dbman->index_exists($table, $index)) {
|
||||
$dbman->add_index($table, $index);
|
||||
}
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2015022401.00);
|
||||
}
|
||||
|
||||
if ($oldversion < 2015022500.00) {
|
||||
$table = new xmldb_table('user_devices');
|
||||
$index = new xmldb_index('uuid-userid', XMLDB_INDEX_NOTUNIQUE, array('uuid', 'userid'));
|
||||
if (!$dbman->index_exists($table, $index)) {
|
||||
$dbman->add_index($table, $index);
|
||||
}
|
||||
upgrade_main_savepoint(true, 2015022500.00);
|
||||
}
|
||||
|
||||
if ($oldversion < 2015030400.00) {
|
||||
// We have long since switched to storing timemodified per hub rather than a single 'registered' timestamp.
|
||||
unset_config('registered');
|
||||
upgrade_main_savepoint(true, 2015030400.00);
|
||||
}
|
||||
|
||||
if ($oldversion < 2015031100.00) {
|
||||
// Unset old config variable.
|
||||
unset_config('enabletgzbackups');
|
||||
|
||||
upgrade_main_savepoint(true, 2015031100.00);
|
||||
}
|
||||
|
||||
if ($oldversion < 2015031400.00) {
|
||||
|
||||
// Define index useridfrom (not unique) to be dropped form message.
|
||||
$table = new xmldb_table('message');
|
||||
$index = new xmldb_index('useridfrom', XMLDB_INDEX_NOTUNIQUE, array('useridfrom'));
|
||||
|
||||
// Conditionally launch drop index useridfrom.
|
||||
if ($dbman->index_exists($table, $index)) {
|
||||
$dbman->drop_index($table, $index);
|
||||
}
|
||||
|
||||
// Define index useridfrom (not unique) to be dropped form message_read.
|
||||
$table = new xmldb_table('message_read');
|
||||
$index = new xmldb_index('useridfrom', XMLDB_INDEX_NOTUNIQUE, array('useridfrom'));
|
||||
|
||||
// Conditionally launch drop index useridfrom.
|
||||
if ($dbman->index_exists($table, $index)) {
|
||||
$dbman->drop_index($table, $index);
|
||||
}
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2015031400.00);
|
||||
}
|
||||
|
||||
if ($oldversion < 2015031900.01) {
|
||||
unset_config('crontime', 'registration');
|
||||
upgrade_main_savepoint(true, 2015031900.01);
|
||||
}
|
||||
|
||||
if ($oldversion < 2015032000.00) {
|
||||
$table = new xmldb_table('badge_criteria');
|
||||
|
||||
$field = new xmldb_field('description', XMLDB_TYPE_TEXT, null, null, null, null, null);
|
||||
// Conditionally add description field to the badge_criteria table.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
$field = new xmldb_field('descriptionformat', XMLDB_TYPE_INTEGER, 2, null, XMLDB_NOTNULL, null, 0);
|
||||
// Conditionally add description format field to the badge_criteria table.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
upgrade_main_savepoint(true, 2015032000.00);
|
||||
}
|
||||
|
||||
if ($oldversion < 2015040200.01) {
|
||||
// Force uninstall of deleted tool.
|
||||
if (!file_exists("$CFG->dirroot/$CFG->admin/tool/timezoneimport")) {
|
||||
// Remove capabilities.
|
||||
capabilities_cleanup('tool_timezoneimport');
|
||||
// Remove all other associated config.
|
||||
unset_all_config_for_plugin('tool_timezoneimport');
|
||||
}
|
||||
upgrade_main_savepoint(true, 2015040200.01);
|
||||
}
|
||||
|
||||
if ($oldversion < 2015040200.02) {
|
||||
// Define table timezone to be dropped.
|
||||
$table = new xmldb_table('timezone');
|
||||
// Conditionally launch drop table for timezone.
|
||||
if ($dbman->table_exists($table)) {
|
||||
$dbman->drop_table($table);
|
||||
}
|
||||
upgrade_main_savepoint(true, 2015040200.02);
|
||||
}
|
||||
|
||||
if ($oldversion < 2015040200.03) {
|
||||
if (isset($CFG->timezone) and $CFG->timezone == 99) {
|
||||
// Migrate to real server timezone.
|
||||
unset_config('timezone');
|
||||
}
|
||||
upgrade_main_savepoint(true, 2015040200.03);
|
||||
}
|
||||
|
||||
if ($oldversion < 2015040700.01) {
|
||||
$DB->delete_records('config_plugins', array('name' => 'requiremodintro'));
|
||||
upgrade_main_savepoint(true, 2015040700.01);
|
||||
}
|
||||
|
||||
if ($oldversion < 2015040900.01) {
|
||||
// Add "My grades" to the user menu.
|
||||
$oldconfig = get_config('core', 'customusermenuitems');
|
||||
if (strpos("mygrades,grades|/grade/report/mygrades.php|grades", $oldconfig) === false) {
|
||||
$newconfig = "mygrades,grades|/grade/report/mygrades.php|grades\n" . $oldconfig;
|
||||
set_config('customusermenuitems', $newconfig);
|
||||
}
|
||||
|
||||
upgrade_main_savepoint(true, 2015040900.01);
|
||||
}
|
||||
|
||||
if ($oldversion < 2015040900.02) {
|
||||
// Update the default user menu (add preferences, remove my files and my badges).
|
||||
$oldconfig = get_config('core', 'customusermenuitems');
|
||||
|
||||
// Add "My preferences" at the end.
|
||||
if (strpos($oldconfig, "mypreferences,moodle|/user/preference.php|preferences") === false) {
|
||||
$newconfig = $oldconfig . "\nmypreferences,moodle|/user/preferences.php|preferences";
|
||||
} else {
|
||||
$newconfig = $oldconfig;
|
||||
}
|
||||
// Remove my files.
|
||||
$newconfig = str_replace("myfiles,moodle|/user/files.php|download", "", $newconfig);
|
||||
// Remove my badges.
|
||||
$newconfig = str_replace("mybadges,badges|/badges/mybadges.php|award", "", $newconfig);
|
||||
// Remove holes.
|
||||
$newconfig = preg_replace('/\n+/', "\n", $newconfig);
|
||||
$newconfig = preg_replace('/(\r\n)+/', "\n", $newconfig);
|
||||
set_config('customusermenuitems', $newconfig);
|
||||
|
||||
upgrade_main_savepoint(true, 2015040900.02);
|
||||
}
|
||||
|
||||
if ($oldversion < 2015050400.00) {
|
||||
$config = get_config('core', 'customusermenuitems');
|
||||
|
||||
// Change "My preferences" in the user menu to "Preferences".
|
||||
$config = str_replace("mypreferences,moodle|/user/preferences.php|preferences",
|
||||
"preferences,moodle|/user/preferences.php|preferences", $config);
|
||||
|
||||
// Change "My grades" in the user menu to "Grades".
|
||||
$config = str_replace("mygrades,grades|/grade/report/mygrades.php|grades",
|
||||
"grades,grades|/grade/report/mygrades.php|grades", $config);
|
||||
|
||||
set_config('customusermenuitems', $config);
|
||||
|
||||
upgrade_main_savepoint(true, 2015050400.00);
|
||||
}
|
||||
|
||||
if ($oldversion < 2015050401.00) {
|
||||
// Make sure we have messages in the user menu because it's no longer in the nav tree.
|
||||
$oldconfig = get_config('core', 'customusermenuitems');
|
||||
$messagesconfig = "messages,message|/message/index.php|message";
|
||||
$preferencesconfig = "preferences,moodle|/user/preferences.php|preferences";
|
||||
|
||||
// See if it exists.
|
||||
if (strpos($oldconfig, $messagesconfig) === false) {
|
||||
// See if preferences exists.
|
||||
if (strpos($oldconfig, "preferences,moodle|/user/preferences.php|preferences") !== false) {
|
||||
// Insert it before preferences.
|
||||
$newconfig = str_replace($preferencesconfig, $messagesconfig . "\n" . $preferencesconfig, $oldconfig);
|
||||
} else {
|
||||
// Custom config - we can only insert it at the end.
|
||||
$newconfig = $oldconfig . "\n" . $messagesconfig;
|
||||
}
|
||||
set_config('customusermenuitems', $newconfig);
|
||||
}
|
||||
|
||||
upgrade_main_savepoint(true, 2015050401.00);
|
||||
}
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2015060400.02) {
|
||||
|
||||
// Sites that were upgrading from 2.7 and older will ignore this step.
|
||||
if (empty($CFG->upgrade_minmaxgradestepignored)) {
|
||||
|
||||
upgrade_minmaxgrade();
|
||||
|
||||
// Flags this upgrade step as already run to prevent it from running multiple times.
|
||||
set_config('upgrade_minmaxgradestepignored', 1);
|
||||
}
|
||||
|
||||
upgrade_main_savepoint(true, 2015060400.02);
|
||||
}
|
||||
|
||||
if ($oldversion < 2015061900.00) {
|
||||
// MDL-49257. Changed the algorithm of calculating automatic weights of extra credit items.
|
||||
|
||||
// Before the change, in case when grade category (in "Natural" agg. method) had items with
|
||||
// overridden weights, the automatic weight of extra credit items was illogical.
|
||||
// In order to prevent grades changes after the upgrade we need to freeze gradebook calculation
|
||||
// for the affected courses.
|
||||
|
||||
// This script in included in each major version upgrade process so make sure we don't run it twice.
|
||||
if (empty($CFG->upgrade_extracreditweightsstepignored)) {
|
||||
upgrade_extra_credit_weightoverride();
|
||||
|
||||
// To skip running the same script on the upgrade to the next major release.
|
||||
set_config('upgrade_extracreditweightsstepignored', 1);
|
||||
}
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2015061900.00);
|
||||
}
|
||||
|
||||
if ($oldversion < 2015062500.01) {
|
||||
// MDL-48239. Changed calculated grade items so that the maximum and minimum grade can be set.
|
||||
|
||||
// If the changes are accepted and a regrade is done on the gradebook then some grades may change significantly.
|
||||
// This is here to freeze the gradebook in affected courses.
|
||||
|
||||
// This script is included in each major version upgrade process so make sure we don't run it twice.
|
||||
if (empty($CFG->upgrade_calculatedgradeitemsignored)) {
|
||||
upgrade_calculated_grade_items();
|
||||
|
||||
// To skip running the same script on the upgrade to the next major release.
|
||||
set_config('upgrade_calculatedgradeitemsignored', 1);
|
||||
// This config value is never used again.
|
||||
unset_config('upgrade_calculatedgradeitemsonlyregrade');
|
||||
}
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2015062500.01);
|
||||
}
|
||||
|
||||
if ($oldversion < 2015081300.01) {
|
||||
|
||||
// Define field importtype to be added to grade_import_values.
|
||||
$table = new xmldb_table('grade_import_values');
|
||||
$field = new xmldb_field('importonlyfeedback', XMLDB_TYPE_INTEGER, '1', null, null, null, '0', 'importer');
|
||||
|
||||
// Conditionally launch add field importtype.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2015081300.01);
|
||||
}
|
||||
|
||||
if ($oldversion < 2015082400.00) {
|
||||
|
||||
// Define table webdav_locks to be dropped.
|
||||
$table = new xmldb_table('webdav_locks');
|
||||
|
||||
// Conditionally launch drop table for webdav_locks.
|
||||
if ($dbman->table_exists($table)) {
|
||||
$dbman->drop_table($table);
|
||||
}
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2015082400.00);
|
||||
}
|
||||
|
||||
if ($oldversion < 2015090200.00) {
|
||||
$table = new xmldb_table('message');
|
||||
|
||||
// Define the deleted fields to be added to the message tables.
|
||||
$field1 = new xmldb_field('timeuserfromdeleted', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0',
|
||||
'timecreated');
|
||||
$field2 = new xmldb_field('timeusertodeleted', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0',
|
||||
'timecreated');
|
||||
$oldindex = new xmldb_index('useridfromto', XMLDB_INDEX_NOTUNIQUE,
|
||||
array('useridfrom', 'useridto'));
|
||||
$newindex = new xmldb_index('useridfromtodeleted', XMLDB_INDEX_NOTUNIQUE,
|
||||
array('useridfrom', 'useridto', 'timeuserfromdeleted', 'timeusertodeleted'));
|
||||
|
||||
// Conditionally launch add field timeuserfromdeleted.
|
||||
if (!$dbman->field_exists($table, $field1)) {
|
||||
$dbman->add_field($table, $field1);
|
||||
}
|
||||
|
||||
// Conditionally launch add field timeusertodeleted.
|
||||
if (!$dbman->field_exists($table, $field2)) {
|
||||
$dbman->add_field($table, $field2);
|
||||
}
|
||||
|
||||
// Conditionally launch drop index useridfromto.
|
||||
if ($dbman->index_exists($table, $oldindex)) {
|
||||
$dbman->drop_index($table, $oldindex);
|
||||
}
|
||||
|
||||
// Conditionally launch add index useridfromtodeleted.
|
||||
if (!$dbman->index_exists($table, $newindex)) {
|
||||
$dbman->add_index($table, $newindex);
|
||||
}
|
||||
|
||||
// Now add them to the message_read table.
|
||||
$table = new xmldb_table('message_read');
|
||||
|
||||
// Conditionally launch add field timeuserfromdeleted.
|
||||
if (!$dbman->field_exists($table, $field1)) {
|
||||
$dbman->add_field($table, $field1);
|
||||
}
|
||||
|
||||
// Conditionally launch add field timeusertodeleted.
|
||||
if (!$dbman->field_exists($table, $field2)) {
|
||||
$dbman->add_field($table, $field2);
|
||||
}
|
||||
|
||||
// Conditionally launch drop index useridfromto.
|
||||
if ($dbman->index_exists($table, $oldindex)) {
|
||||
$dbman->drop_index($table, $oldindex);
|
||||
}
|
||||
|
||||
// Conditionally launch add index useridfromtodeleted.
|
||||
if (!$dbman->index_exists($table, $newindex)) {
|
||||
$dbman->add_index($table, $newindex);
|
||||
}
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2015090200.00);
|
||||
}
|
||||
|
||||
if ($oldversion < 2015090801.00) {
|
||||
// This upgrade script merges all tag instances pointing to the same course tag.
|
||||
// User id is no longer used for those tag instances.
|
||||
upgrade_course_tags();
|
||||
|
||||
// If configuration variable "Show course tags" is set, disable the block
|
||||
// 'tags' because it can not be used for tagging courses any more.
|
||||
if (!empty($CFG->block_tags_showcoursetags)) {
|
||||
if ($record = $DB->get_record('block', array('name' => 'tags'), 'id, visible')) {
|
||||
if ($record->visible) {
|
||||
$DB->update_record('block', array('id' => $record->id, 'visible' => 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Define index idname (unique) to be dropped form tag (it's really weird).
|
||||
$table = new xmldb_table('tag');
|
||||
$index = new xmldb_index('idname', XMLDB_INDEX_UNIQUE, array('id', 'name'));
|
||||
|
||||
// Conditionally launch drop index idname.
|
||||
if ($dbman->index_exists($table, $index)) {
|
||||
$dbman->drop_index($table, $index);
|
||||
}
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2015090801.00);
|
||||
}
|
||||
|
||||
if ($oldversion < 2015092200.00) {
|
||||
// Define index qtype (not unique) to be added to question.
|
||||
$table = new xmldb_table('question');
|
||||
$index = new xmldb_index('qtype', XMLDB_INDEX_NOTUNIQUE, array('qtype'));
|
||||
|
||||
// Conditionally launch add index qtype.
|
||||
if (!$dbman->index_exists($table, $index)) {
|
||||
$dbman->add_index($table, $index);
|
||||
}
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2015092200.00);
|
||||
}
|
||||
|
||||
if ($oldversion < 2015092900.00) {
|
||||
// Rename backup_auto_keep setting to backup_auto_max_kept.
|
||||
$keep = get_config('backup', 'backup_auto_keep');
|
||||
if ($keep !== false) {
|
||||
set_config('backup_auto_max_kept', $keep, 'backup');
|
||||
unset_config('backup_auto_keep', 'backup');
|
||||
}
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2015092900.00);
|
||||
}
|
||||
|
||||
if ($oldversion < 2015100600.00) {
|
||||
|
||||
// Define index notification (not unique) to be added to message_read.
|
||||
$table = new xmldb_table('message_read');
|
||||
$index = new xmldb_index('notificationtimeread', XMLDB_INDEX_NOTUNIQUE, array('notification', 'timeread'));
|
||||
|
||||
// Conditionally launch add index notification.
|
||||
if (!$dbman->index_exists($table, $index)) {
|
||||
$dbman->add_index($table, $index);
|
||||
}
|
||||
|
||||
// Main savepoint reached.
|
||||
upgrade_main_savepoint(true, 2015100600.00);
|
||||
}
|
||||
|
||||
if ($oldversion < 2015100800.01) {
|
||||
// The only flag for preventing all plugins installation features is
|
||||
// now $CFG->disableupdateautodeploy in config.php.
|
||||
unset_config('updateautodeploy');
|
||||
upgrade_main_savepoint(true, 2015100800.01);
|
||||
}
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2016011300.01) {
|
||||
|
||||
// This is a big upgrade script. We create new table tag_coll and the field
|
||||
|
||||
@@ -30,61 +30,7 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @return bool
|
||||
*/
|
||||
function xmldb_editor_atto_upgrade($oldversion) {
|
||||
global $CFG, $DB;
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
if ($oldversion < 2014081400) {
|
||||
|
||||
// Define table editor_atto_autosave to be created.
|
||||
$table = new xmldb_table('editor_atto_autosave');
|
||||
|
||||
// Adding fields to table editor_atto_autosave.
|
||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
|
||||
$table->add_field('elementid', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('contextid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('pagehash', XMLDB_TYPE_CHAR, '64', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('userid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('drafttext', XMLDB_TYPE_TEXT, null, null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('draftid', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
|
||||
$table->add_field('pageinstance', XMLDB_TYPE_CHAR, '64', null, XMLDB_NOTNULL, null, null);
|
||||
|
||||
// Adding keys to table editor_atto_autosave.
|
||||
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
|
||||
$table->add_key('autosave_uniq_key', XMLDB_KEY_UNIQUE, array('elementid', 'contextid', 'userid', 'pagehash'));
|
||||
|
||||
// Conditionally launch create table for editor_atto_autosave.
|
||||
if (!$dbman->table_exists($table)) {
|
||||
$dbman->create_table($table);
|
||||
}
|
||||
|
||||
// Atto savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2014081400, 'editor', 'atto');
|
||||
}
|
||||
|
||||
if ($oldversion < 2014081900) {
|
||||
|
||||
// Define field timemodified to be added to editor_atto_autosave.
|
||||
$table = new xmldb_table('editor_atto_autosave');
|
||||
$field = new xmldb_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0', 'pageinstance');
|
||||
|
||||
// Conditionally launch add field timemodified.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Atto savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2014081900, 'editor', 'atto');
|
||||
}
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
global $CFG;
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
@@ -30,17 +30,7 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @return bool
|
||||
*/
|
||||
function xmldb_atto_equation_upgrade($oldversion) {
|
||||
require_once(__DIR__ . '/upgradelib.php');
|
||||
|
||||
if ($oldversion < 2015083100) {
|
||||
atto_equation_update_librarygroup4_setting();
|
||||
|
||||
// Atto equation savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2015083100, 'atto', 'equation');
|
||||
}
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
global $CFG;
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
@@ -52,4 +42,4 @@ function xmldb_atto_equation_upgrade($oldversion) {
|
||||
// Put any upgrade step following this.
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,36 +25,7 @@
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
function xmldb_editor_tinymce_upgrade($oldversion) {
|
||||
global $CFG, $DB;
|
||||
|
||||
if ($oldversion < 2014062900) {
|
||||
// We only want to delete DragMath from the customtoolbar setting if the directory no longer exists. If
|
||||
// the directory is present then it means it has been restored, so do not remove any settings.
|
||||
if (!check_dir_exists($CFG->libdir . '/editor/tinymce/plugins/dragmath', false)) {
|
||||
// Remove the DragMath plugin from the 'customtoolbar' setting (if it exists) as it has been removed.
|
||||
$currentorder = get_config('editor_tinymce', 'customtoolbar');
|
||||
$newtoolbarrows = array();
|
||||
$currenttoolbarrows = explode("\n", $currentorder);
|
||||
foreach ($currenttoolbarrows as $currenttoolbarrow) {
|
||||
$currenttoolbarrow = implode(',', array_diff(str_getcsv($currenttoolbarrow), array('dragmath')));
|
||||
$newtoolbarrows[] = $currenttoolbarrow;
|
||||
}
|
||||
$neworder = implode("\n", $newtoolbarrows);
|
||||
unset_config('customtoolbar', 'editor_tinymce');
|
||||
set_config('customtoolbar', $neworder, 'editor_tinymce');
|
||||
}
|
||||
|
||||
upgrade_plugin_savepoint(true, 2014062900, 'editor', 'tinymce');
|
||||
}
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
global $CFG;
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
@@ -27,15 +27,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_tinymce_spellchecker_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -32,15 +32,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_message_email_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -32,15 +32,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_message_jabber_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -32,15 +32,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_message_popup_upgrade($oldversion) {
|
||||
global $CFG, $DB;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -34,169 +34,6 @@ function xmldb_assign_upgrade($oldversion) {
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
if ($oldversion < 2014051201) {
|
||||
|
||||
// Cleanup bad database records where assignid is missing.
|
||||
|
||||
$DB->delete_records('assign_user_mapping', array('assignment'=>0));
|
||||
// Assign savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2014051201, 'assign');
|
||||
}
|
||||
|
||||
if ($oldversion < 2014072400) {
|
||||
|
||||
// Add "latest" column to submissions table to mark the latest attempt.
|
||||
$table = new xmldb_table('assign_submission');
|
||||
$field = new xmldb_field('latest', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '0', 'attemptnumber');
|
||||
|
||||
// Conditionally launch add field latest.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Assign savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2014072400, 'assign');
|
||||
}
|
||||
if ($oldversion < 2014072401) {
|
||||
|
||||
// Define index latestattempt (not unique) to be added to assign_submission.
|
||||
$table = new xmldb_table('assign_submission');
|
||||
$index = new xmldb_index('latestattempt', XMLDB_INDEX_NOTUNIQUE, array('assignment', 'userid', 'groupid', 'latest'));
|
||||
|
||||
// Conditionally launch add index latestattempt.
|
||||
if (!$dbman->index_exists($table, $index)) {
|
||||
$dbman->add_index($table, $index);
|
||||
}
|
||||
|
||||
// Assign savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2014072401, 'assign');
|
||||
}
|
||||
if ($oldversion < 2014072405) {
|
||||
|
||||
// Prevent running this multiple times.
|
||||
|
||||
$countsql = 'SELECT COUNT(id) FROM {assign_submission} WHERE latest = ?';
|
||||
|
||||
$count = $DB->count_records_sql($countsql, array(1));
|
||||
if ($count == 0) {
|
||||
|
||||
// Mark the latest attempt for every submission in mod_assign.
|
||||
$maxattemptsql = 'SELECT assignment, userid, groupid, max(attemptnumber) AS maxattempt
|
||||
FROM {assign_submission}
|
||||
GROUP BY assignment, groupid, userid';
|
||||
|
||||
$maxattemptidssql = 'SELECT souter.id
|
||||
FROM {assign_submission} souter
|
||||
JOIN (' . $maxattemptsql . ') sinner
|
||||
ON souter.assignment = sinner.assignment
|
||||
AND souter.userid = sinner.userid
|
||||
AND souter.groupid = sinner.groupid
|
||||
AND souter.attemptnumber = sinner.maxattempt';
|
||||
|
||||
// We need to avoid using "WHERE ... IN(SELECT ...)" clause with MySQL for performance reason.
|
||||
// TODO MDL-29589 Remove this dbfamily exception when implemented.
|
||||
if ($DB->get_dbfamily() === 'mysql') {
|
||||
$params = array('latest' => 1);
|
||||
$sql = 'UPDATE {assign_submission}
|
||||
INNER JOIN (' . $maxattemptidssql . ') souterouter ON souterouter.id = {assign_submission}.id
|
||||
SET latest = :latest';
|
||||
$DB->execute($sql, $params);
|
||||
} else {
|
||||
$select = 'id IN(' . $maxattemptidssql . ')';
|
||||
$DB->set_field_select('assign_submission', 'latest', 1, $select);
|
||||
}
|
||||
|
||||
// Look for grade records with no submission record.
|
||||
// This is when a teacher has marked a student before they submitted anything.
|
||||
$records = $DB->get_records_sql('SELECT g.id, g.assignment, g.userid
|
||||
FROM {assign_grades} g
|
||||
LEFT JOIN {assign_submission} s
|
||||
ON s.assignment = g.assignment
|
||||
AND s.userid = g.userid
|
||||
WHERE s.id IS NULL');
|
||||
$submissions = array();
|
||||
foreach ($records as $record) {
|
||||
$submission = new stdClass();
|
||||
$submission->assignment = $record->assignment;
|
||||
$submission->userid = $record->userid;
|
||||
$submission->status = 'new';
|
||||
$submission->groupid = 0;
|
||||
$submission->latest = 1;
|
||||
$submission->timecreated = time();
|
||||
$submission->timemodified = time();
|
||||
array_push($submissions, $submission);
|
||||
}
|
||||
|
||||
$DB->insert_records('assign_submission', $submissions);
|
||||
}
|
||||
|
||||
// Assign savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2014072405, 'assign');
|
||||
}
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2014122600) {
|
||||
// Delete any entries from the assign_user_flags and assign_user_mapping that are no longer required.
|
||||
if ($DB->get_dbfamily() === 'mysql') {
|
||||
$sql1 = "DELETE {assign_user_flags}
|
||||
FROM {assign_user_flags}
|
||||
LEFT JOIN {assign}
|
||||
ON {assign_user_flags}.assignment = {assign}.id
|
||||
WHERE {assign}.id IS NULL";
|
||||
|
||||
$sql2 = "DELETE {assign_user_mapping}
|
||||
FROM {assign_user_mapping}
|
||||
LEFT JOIN {assign}
|
||||
ON {assign_user_mapping}.assignment = {assign}.id
|
||||
WHERE {assign}.id IS NULL";
|
||||
} else {
|
||||
$sql1 = "DELETE FROM {assign_user_flags}
|
||||
WHERE NOT EXISTS (
|
||||
SELECT 'x' FROM {assign}
|
||||
WHERE {assign_user_flags}.assignment = {assign}.id)";
|
||||
|
||||
$sql2 = "DELETE FROM {assign_user_mapping}
|
||||
WHERE NOT EXISTS (
|
||||
SELECT 'x' FROM {assign}
|
||||
WHERE {assign_user_mapping}.assignment = {assign}.id)";
|
||||
}
|
||||
|
||||
$DB->execute($sql1);
|
||||
$DB->execute($sql2);
|
||||
|
||||
upgrade_mod_savepoint(true, 2014122600, 'assign');
|
||||
}
|
||||
|
||||
if ($oldversion < 2015022300) {
|
||||
|
||||
// Define field preventsubmissionnotingroup to be added to assign.
|
||||
$table = new xmldb_table('assign');
|
||||
$field = new xmldb_field('preventsubmissionnotingroup',
|
||||
XMLDB_TYPE_INTEGER,
|
||||
'2',
|
||||
null,
|
||||
XMLDB_NOTNULL,
|
||||
null,
|
||||
'0',
|
||||
'sendstudentnotifications');
|
||||
|
||||
// Conditionally launch add field preventsubmissionnotingroup.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Assign savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2015022300, 'assign');
|
||||
}
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -32,15 +32,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_assignfeedback_comments_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -34,15 +34,6 @@ function xmldb_assignfeedback_editpdf_upgrade($oldversion) {
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2016021600) {
|
||||
|
||||
// Define table assignfeedback_editpdf_queue to be created.
|
||||
|
||||
@@ -32,15 +32,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_assignfeedback_file_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -32,15 +32,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_assignsubmission_comments_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -32,15 +32,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_assignsubmission_file_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -32,15 +32,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_assignsubmission_onlinetext_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -24,15 +24,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_assignment_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
+1
-27
@@ -30,33 +30,7 @@ defined('MOODLE_INTERNAL') || die;
|
||||
* @return bool always true
|
||||
*/
|
||||
function xmldb_book_upgrade($oldversion) {
|
||||
global $CFG, $DB;
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2014111800) {
|
||||
|
||||
// Define field navstyle to be added to book.
|
||||
$table = new xmldb_table('book');
|
||||
$field = new xmldb_field('navstyle', XMLDB_TYPE_INTEGER, '4', null, XMLDB_NOTNULL, null, '1', 'numbering');
|
||||
|
||||
// Conditionally launch add field navstyle.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Book savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2014111800, 'book');
|
||||
}
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
global $CFG;
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
@@ -27,15 +27,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_chat_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -22,63 +22,7 @@
|
||||
defined('MOODLE_INTERNAL') || die();
|
||||
|
||||
function xmldb_choice_upgrade($oldversion) {
|
||||
global $CFG, $DB;
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
if ($oldversion < 2014051201) {
|
||||
|
||||
// Define field allowmultiple to be added to choice.
|
||||
$table = new xmldb_table('choice');
|
||||
$field = new xmldb_field('allowmultiple', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '0', 'allowupdate');
|
||||
|
||||
// Conditionally launch add field allowmultiple.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Choice savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2014051201, 'choice');
|
||||
}
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2014111001) {
|
||||
|
||||
// Define field showpreview to be added to choice.
|
||||
$table = new xmldb_table('choice');
|
||||
$field = new xmldb_field('showpreview', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '0', 'timeclose');
|
||||
|
||||
// Conditionally launch add field showpreview.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Choice savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2014111001, 'choice');
|
||||
}
|
||||
|
||||
if ($oldversion < 2014111002) {
|
||||
|
||||
// Define field includeinactive to be added to choice.
|
||||
$table = new xmldb_table('choice');
|
||||
$field = new xmldb_field('includeinactive', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '1', 'showunanswered');
|
||||
|
||||
// Conditionally launch add field includeactive.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Choice savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2014111002, 'choice');
|
||||
}
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
global $CFG;
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
@@ -26,43 +26,6 @@ function xmldb_data_upgrade($oldversion) {
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2015030900) {
|
||||
// Define field required to be added to data_fields.
|
||||
$table = new xmldb_table('data_fields');
|
||||
$field = new xmldb_field('required', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '0', 'description');
|
||||
|
||||
// Conditionally launch add field required.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
upgrade_mod_savepoint(true, 2015030900, 'data');
|
||||
}
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2015092200) {
|
||||
|
||||
// Define field manageapproved to be added to data.
|
||||
$table = new xmldb_table('data');
|
||||
$field = new xmldb_field('manageapproved', XMLDB_TYPE_INTEGER, '4', null, XMLDB_NOTNULL, null, '1', 'approval');
|
||||
|
||||
// Conditionally launch add field manageapproved.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Data savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2015092200, 'data');
|
||||
}
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2016030300) {
|
||||
|
||||
// Define field timemodified to be added to data.
|
||||
|
||||
@@ -42,15 +42,6 @@ function xmldb_feedback_upgrade($oldversion) {
|
||||
|
||||
$dbman = $DB->get_manager(); // Loads ddl manager and xmldb classes.
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2016031600) {
|
||||
// Remove labels from all 'captcha' and 'label' items.
|
||||
$DB->execute('UPDATE {feedback_item} SET label = ? WHERE typ = ? OR typ = ?',
|
||||
|
||||
@@ -49,16 +49,6 @@ function xmldb_folder_upgrade($oldversion) {
|
||||
|
||||
$dbman = $DB->get_manager(); // Loads ddl manager and xmldb classes.
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
// Add showdownloadfolder option.
|
||||
if ($oldversion < 2016020201) {
|
||||
$table = new xmldb_table('folder');
|
||||
|
||||
@@ -47,120 +47,6 @@ function xmldb_forum_upgrade($oldversion) {
|
||||
|
||||
$dbman = $DB->get_manager(); // Loads ddl manager and xmldb classes.
|
||||
|
||||
if ($oldversion < 2014051201) {
|
||||
|
||||
// Incorrect values that need to be replaced.
|
||||
$replacements = array(
|
||||
11 => 20,
|
||||
12 => 50,
|
||||
13 => 100
|
||||
);
|
||||
|
||||
// Run the replacements.
|
||||
foreach ($replacements as $old => $new) {
|
||||
$DB->set_field('forum', 'maxattachments', $new, array('maxattachments' => $old));
|
||||
}
|
||||
|
||||
// Forum savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2014051201, 'forum');
|
||||
}
|
||||
|
||||
if ($oldversion < 2014081500) {
|
||||
|
||||
// Define index course (not unique) to be added to forum_discussions.
|
||||
$table = new xmldb_table('forum_discussions');
|
||||
$index = new xmldb_index('course', XMLDB_INDEX_NOTUNIQUE, array('course'));
|
||||
|
||||
// Conditionally launch add index course.
|
||||
if (!$dbman->index_exists($table, $index)) {
|
||||
$dbman->add_index($table, $index);
|
||||
}
|
||||
|
||||
// Forum savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2014081500, 'forum');
|
||||
}
|
||||
|
||||
if ($oldversion < 2014081900) {
|
||||
|
||||
// Define table forum_discussion_subs to be created.
|
||||
$table = new xmldb_table('forum_discussion_subs');
|
||||
|
||||
// Adding fields to table forum_discussion_subs.
|
||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
|
||||
$table->add_field('forum', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('userid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('discussion', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('preference', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '1');
|
||||
|
||||
// Adding keys to table forum_discussion_subs.
|
||||
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
|
||||
$table->add_key('forum', XMLDB_KEY_FOREIGN, array('forum'), 'forum', array('id'));
|
||||
$table->add_key('userid', XMLDB_KEY_FOREIGN, array('userid'), 'user', array('id'));
|
||||
$table->add_key('discussion', XMLDB_KEY_FOREIGN, array('discussion'), 'forum_discussions', array('id'));
|
||||
$table->add_key('user_discussions', XMLDB_KEY_UNIQUE, array('userid', 'discussion'));
|
||||
|
||||
// Conditionally launch create table for forum_discussion_subs.
|
||||
if (!$dbman->table_exists($table)) {
|
||||
$dbman->create_table($table);
|
||||
}
|
||||
|
||||
// Forum savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2014081900, 'forum');
|
||||
}
|
||||
|
||||
if ($oldversion < 2014103000) {
|
||||
// Find records with multiple userid/postid combinations and find the lowest ID.
|
||||
// Later we will remove all those which don't match this ID.
|
||||
$sql = "
|
||||
SELECT MIN(id) as lowid, userid, postid
|
||||
FROM {forum_read}
|
||||
GROUP BY userid, postid
|
||||
HAVING COUNT(id) > 1";
|
||||
|
||||
if ($duplicatedrows = $DB->get_recordset_sql($sql)) {
|
||||
foreach ($duplicatedrows as $row) {
|
||||
$DB->delete_records_select('forum_read', 'userid = ? AND postid = ? AND id <> ?', array(
|
||||
$row->userid,
|
||||
$row->postid,
|
||||
$row->lowid,
|
||||
));
|
||||
}
|
||||
}
|
||||
$duplicatedrows->close();
|
||||
|
||||
// Forum savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2014103000, 'forum');
|
||||
}
|
||||
|
||||
if ($oldversion < 2014110300) {
|
||||
|
||||
// Changing precision of field preference on table forum_discussion_subs to (10).
|
||||
$table = new xmldb_table('forum_discussion_subs');
|
||||
$field = new xmldb_field('preference', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '1', 'discussion');
|
||||
|
||||
// Launch change of precision for field preference.
|
||||
$dbman->change_field_precision($table, $field);
|
||||
|
||||
// Forum savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2014110300, 'forum');
|
||||
}
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
if ($oldversion < 2015102900) {
|
||||
// Groupid = 0 is never valid.
|
||||
$DB->set_field('forum_discussions', 'groupid', -1, array('groupid' => 0));
|
||||
|
||||
// Forum savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2015102900, 'forum');
|
||||
}
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2015120800) {
|
||||
|
||||
// Add support for pinned discussions.
|
||||
|
||||
@@ -20,33 +20,7 @@
|
||||
// before any action that may take longer time to finish.
|
||||
|
||||
function xmldb_glossary_upgrade($oldversion) {
|
||||
global $CFG, $DB;
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2015060200) {
|
||||
|
||||
// Define field showtabs to be added to glossary_formats.
|
||||
$table = new xmldb_table('glossary_formats');
|
||||
$field = new xmldb_field('showtabs', XMLDB_TYPE_CHAR, '100', null, null, null, null, 'showgroup');
|
||||
|
||||
// Conditionally launch add field showtabs.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Glossary savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2015060200, 'glossary');
|
||||
}
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
global $CFG;
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
@@ -31,15 +31,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_imscp_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -47,15 +47,6 @@ defined('MOODLE_INTERNAL') || die;
|
||||
function xmldb_label_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -54,281 +54,6 @@ function xmldb_lesson_upgrade($oldversion) {
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
if ($oldversion < 2014091001) {
|
||||
$table = new xmldb_table('lesson');
|
||||
$field = new xmldb_field('intro', XMLDB_TYPE_TEXT, null, null, null, null, null, 'name');
|
||||
// Conditionally launch add field.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
$field = new xmldb_field('introformat', XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'intro');
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
upgrade_mod_savepoint(true, 2014091001, 'lesson');
|
||||
}
|
||||
|
||||
if ($oldversion < 2014100600) {
|
||||
// Previously there was no module intro in lesson so don't require
|
||||
// it to be filled in for upgraded sites.
|
||||
set_config('requiremodintro', 0, 'lesson');
|
||||
upgrade_mod_savepoint(true, 2014100600, 'lesson');
|
||||
}
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2014112300) {
|
||||
|
||||
// Define field completionendreached to be added to lesson.
|
||||
$table = new xmldb_table('lesson');
|
||||
$field = new xmldb_field('completionendreached', XMLDB_TYPE_INTEGER, '1', null, null, null, '0', 'timemodified');
|
||||
|
||||
// Conditionally launch add field completionendreached.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Define field completed to be added to lesson_timer.
|
||||
$table = new xmldb_table('lesson_timer');
|
||||
$field = new xmldb_field('completed', XMLDB_TYPE_INTEGER, '1', null, null, null, '0', 'lessontime');
|
||||
|
||||
// Conditionally launch add field completed.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
// Lesson savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2014112300, 'lesson');
|
||||
}
|
||||
|
||||
if ($oldversion < 2014122900) {
|
||||
|
||||
// Changing precision of field grade on table lesson to (10).
|
||||
$table = new xmldb_table('lesson');
|
||||
$field = new xmldb_field('grade', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0', 'conditions');
|
||||
|
||||
// Launch change of precision for field grade.
|
||||
$dbman->change_field_precision($table, $field);
|
||||
|
||||
// Lesson savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2014122900, 'lesson');
|
||||
}
|
||||
|
||||
if ($oldversion < 2015030300) {
|
||||
|
||||
// Define field nextpageid to be added to lesson_branch.
|
||||
$table = new xmldb_table('lesson_branch');
|
||||
$field = new xmldb_field('nextpageid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0', 'timeseen');
|
||||
|
||||
// Conditionally launch add field nextpageid.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Lesson savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2015030300, 'lesson');
|
||||
}
|
||||
|
||||
if ($oldversion < 2015030301) {
|
||||
|
||||
// Clean lesson answers that should be plain text.
|
||||
// Unfortunately we can't use LESSON_PAGE_XX constants here as we can't include the files.
|
||||
// 1 = LESSON_PAGE_SHORTANSWER, 8 = LESSON_PAGE_NUMERICAL, 20 = LESSON_PAGE_BRANCHTABLE.
|
||||
|
||||
$sql = 'SELECT a.*
|
||||
FROM {lesson_answers} a
|
||||
JOIN {lesson_pages} p ON p.id = a.pageid
|
||||
WHERE a.answerformat <> :format
|
||||
AND p.qtype IN (1, 8, 20)';
|
||||
$badanswers = $DB->get_recordset_sql($sql, array('format' => FORMAT_MOODLE));
|
||||
|
||||
foreach ($badanswers as $badanswer) {
|
||||
// Strip tags from answer text and convert back the format to FORMAT_MOODLE.
|
||||
$badanswer->answer = strip_tags($badanswer->answer);
|
||||
$badanswer->answerformat = FORMAT_MOODLE;
|
||||
$DB->update_record('lesson_answers', $badanswer);
|
||||
}
|
||||
$badanswers->close();
|
||||
|
||||
// Lesson savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2015030301, 'lesson');
|
||||
}
|
||||
|
||||
if ($oldversion < 2015030400) {
|
||||
|
||||
// Creating new field timelimit in lesson table.
|
||||
$table = new xmldb_table('lesson');
|
||||
$field = new xmldb_field('timelimit', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0', 'maxpages');
|
||||
|
||||
// Conditionally launch add field timelimit.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Lesson savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2015030400, 'lesson');
|
||||
}
|
||||
|
||||
if ($oldversion < 2015030401) {
|
||||
|
||||
// Convert maxtime (minutes) to timelimit (seconds).
|
||||
$table = new xmldb_table('lesson');
|
||||
$oldfield = new xmldb_field('maxtime');
|
||||
$newfield = new xmldb_field('timelimit');
|
||||
if ($dbman->field_exists($table, $oldfield) && $dbman->field_exists($table, $newfield)) {
|
||||
$sql = 'UPDATE {lesson} SET timelimit = 60 * maxtime';
|
||||
$DB->execute($sql);
|
||||
// Drop field maxtime.
|
||||
$dbman->drop_field($table, $oldfield);
|
||||
}
|
||||
|
||||
$oldfield = new xmldb_field('timed');
|
||||
if ($dbman->field_exists($table, $oldfield) && $dbman->field_exists($table, $newfield)) {
|
||||
// Set timelimit to 0 for non timed lessons.
|
||||
$DB->set_field_select('lesson', 'timelimit', 0, 'timed = 0');
|
||||
// Drop field timed.
|
||||
$dbman->drop_field($table, $oldfield);
|
||||
}
|
||||
// Lesson savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2015030401, 'lesson');
|
||||
}
|
||||
|
||||
if ($oldversion < 2015031500) {
|
||||
|
||||
// Define field completiontimespent to be added to lesson.
|
||||
$table = new xmldb_table('lesson');
|
||||
$field = new xmldb_field('completiontimespent', XMLDB_TYPE_INTEGER, '11', null, null, null, '0', 'completionendreached');
|
||||
|
||||
// Conditionally launch add field completiontimespent.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Lesson savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2015031500, 'lesson');
|
||||
}
|
||||
|
||||
if ($oldversion < 2015032600) {
|
||||
|
||||
// Change practice lesson to allow multiple attempts
|
||||
// so that behaviour is not changed by MDL-18966.
|
||||
$DB->set_field('lesson', 'retake', 1, array('practice' => 1));
|
||||
|
||||
// Lesson savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2015032600, 'lesson');
|
||||
}
|
||||
|
||||
if ($oldversion < 2015032700) {
|
||||
// Delete any orphaned lesson_branch record.
|
||||
if ($DB->get_dbfamily() === 'mysql') {
|
||||
$sql = "DELETE {lesson_branch}
|
||||
FROM {lesson_branch}
|
||||
LEFT JOIN {lesson_pages}
|
||||
ON {lesson_branch}.pageid = {lesson_pages}.id
|
||||
WHERE {lesson_pages}.id IS NULL";
|
||||
} else {
|
||||
$sql = "DELETE FROM {lesson_branch}
|
||||
WHERE NOT EXISTS (
|
||||
SELECT 'x' FROM {lesson_pages}
|
||||
WHERE {lesson_branch}.pageid = {lesson_pages}.id)";
|
||||
}
|
||||
|
||||
$DB->execute($sql);
|
||||
|
||||
// Lesson savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2015032700, 'lesson');
|
||||
}
|
||||
|
||||
if ($oldversion < 2015033100) {
|
||||
|
||||
// Define table lesson_overrides to be created.
|
||||
$table = new xmldb_table('lesson_overrides');
|
||||
|
||||
// Adding fields to table lesson_overrides.
|
||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
|
||||
$table->add_field('lessonid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0');
|
||||
$table->add_field('groupid', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
|
||||
$table->add_field('userid', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
|
||||
$table->add_field('available', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
|
||||
$table->add_field('deadline', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
|
||||
$table->add_field('timelimit', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
|
||||
$table->add_field('review', XMLDB_TYPE_INTEGER, '3', null, null, null, null);
|
||||
$table->add_field('maxattempts', XMLDB_TYPE_INTEGER, '3', null, null, null, null);
|
||||
$table->add_field('retake', XMLDB_TYPE_INTEGER, '3', null, null, null, null);
|
||||
$table->add_field('password', XMLDB_TYPE_CHAR, '32', null, null, null, null);
|
||||
|
||||
// Adding keys to table lesson_overrides.
|
||||
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
|
||||
$table->add_key('lessonid', XMLDB_KEY_FOREIGN, array('lessonid'), 'lesson', array('id'));
|
||||
$table->add_key('groupid', XMLDB_KEY_FOREIGN, array('groupid'), 'groups', array('id'));
|
||||
$table->add_key('userid', XMLDB_KEY_FOREIGN, array('userid'), 'user', array('id'));
|
||||
|
||||
// Conditionally launch create table for lesson_overrides.
|
||||
if (!$dbman->table_exists($table)) {
|
||||
$dbman->create_table($table);
|
||||
}
|
||||
|
||||
// Lesson savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2015033100, 'lesson');
|
||||
}
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2015071800) {
|
||||
|
||||
// Define table lesson_high_scores to be dropped.
|
||||
$table = new xmldb_table('lesson_high_scores');
|
||||
|
||||
// Conditionally launch drop table for lesson_high_scores.
|
||||
if ($dbman->table_exists($table)) {
|
||||
$dbman->drop_table($table);
|
||||
}
|
||||
|
||||
// Lesson savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2015071800, 'lesson');
|
||||
}
|
||||
|
||||
if ($oldversion < 2015071801) {
|
||||
|
||||
// Define field highscores to be dropped from lesson.
|
||||
$table = new xmldb_table('lesson');
|
||||
$field = new xmldb_field('highscores');
|
||||
|
||||
// Conditionally launch drop field highscores.
|
||||
if ($dbman->field_exists($table, $field)) {
|
||||
$dbman->drop_field($table, $field);
|
||||
}
|
||||
|
||||
// Lesson savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2015071801, 'lesson');
|
||||
}
|
||||
|
||||
if ($oldversion < 2015071802) {
|
||||
|
||||
// Define field maxhighscores to be dropped from lesson.
|
||||
$table = new xmldb_table('lesson');
|
||||
$field = new xmldb_field('maxhighscores');
|
||||
|
||||
// Conditionally launch drop field maxhighscores.
|
||||
if ($dbman->field_exists($table, $field)) {
|
||||
$dbman->drop_field($table, $field);
|
||||
}
|
||||
|
||||
// Lesson savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2015071802, 'lesson');
|
||||
}
|
||||
|
||||
if ($oldversion < 2015071803) {
|
||||
unset_config('lesson_maxhighscores');
|
||||
|
||||
// Lesson savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2015071803, 'lesson');
|
||||
}
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2016012800) {
|
||||
// Convert lesson settings to use config_plugins instead of $CFG.
|
||||
// Lesson_maxanswers => mod_lesson/maxanswers.
|
||||
|
||||
@@ -65,120 +65,6 @@ function xmldb_lti_upgrade($oldversion) {
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
if ($oldversion < 2014060201) {
|
||||
|
||||
// Changing type of field grade on table lti to int.
|
||||
$table = new xmldb_table('lti');
|
||||
$field = new xmldb_field('grade', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '100',
|
||||
'instructorchoiceacceptgrades');
|
||||
|
||||
// Launch change of type for field grade.
|
||||
$dbman->change_field_type($table, $field);
|
||||
|
||||
// Lti savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2014060201, 'lti');
|
||||
}
|
||||
|
||||
if ($oldversion < 2014061200) {
|
||||
|
||||
// Define table lti_tool_proxies to be created.
|
||||
$table = new xmldb_table('lti_tool_proxies');
|
||||
|
||||
// Adding fields to table lti_tool_proxies.
|
||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
|
||||
$table->add_field('name', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, 'Tool Provider');
|
||||
$table->add_field('regurl', XMLDB_TYPE_TEXT, null, null, null, null, null);
|
||||
$table->add_field('state', XMLDB_TYPE_INTEGER, '2', null, XMLDB_NOTNULL, null, '1');
|
||||
$table->add_field('guid', XMLDB_TYPE_CHAR, '255', null, null, null, null);
|
||||
$table->add_field('secret', XMLDB_TYPE_CHAR, '255', null, null, null, null);
|
||||
$table->add_field('vendorcode', XMLDB_TYPE_CHAR, '255', null, null, null, null);
|
||||
$table->add_field('capabilityoffered', XMLDB_TYPE_TEXT, null, null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('serviceoffered', XMLDB_TYPE_TEXT, null, null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('toolproxy', XMLDB_TYPE_TEXT, null, null, null, null, null);
|
||||
$table->add_field('createdby', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
|
||||
// Adding keys to table lti_tool_proxies.
|
||||
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
|
||||
|
||||
// Adding indexes to table lti_tool_proxies.
|
||||
$table->add_index('guid', XMLDB_INDEX_UNIQUE, array('guid'));
|
||||
|
||||
// Conditionally launch create table for lti_tool_proxies.
|
||||
if (!$dbman->table_exists($table)) {
|
||||
$dbman->create_table($table);
|
||||
}
|
||||
|
||||
// Define table lti_tool_settings to be created.
|
||||
$table = new xmldb_table('lti_tool_settings');
|
||||
|
||||
// Adding fields to table lti_tool_settings.
|
||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
|
||||
$table->add_field('toolproxyid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('course', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
|
||||
$table->add_field('coursemoduleid', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
|
||||
$table->add_field('settings', XMLDB_TYPE_TEXT, null, null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('timecreated', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('timemodified', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
|
||||
// Adding keys to table lti_tool_settings.
|
||||
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
|
||||
$table->add_key('toolproxy', XMLDB_KEY_FOREIGN, array('toolproxyid'), 'lti_tool_proxies', array('id'));
|
||||
$table->add_key('course', XMLDB_KEY_FOREIGN, array('course'), 'course', array('id'));
|
||||
$table->add_key('coursemodule', XMLDB_KEY_FOREIGN, array('coursemoduleid'), 'lti', array('id'));
|
||||
|
||||
// Conditionally launch create table for lti_tool_settings.
|
||||
if (!$dbman->table_exists($table)) {
|
||||
$dbman->create_table($table);
|
||||
}
|
||||
|
||||
// Define table lti_types to be updated.
|
||||
$table = new xmldb_table('lti_types');
|
||||
|
||||
// Adding fields to table lti_types.
|
||||
$field = new xmldb_field('toolproxyid', XMLDB_TYPE_INTEGER, '10', null, null, null, null);
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
$field = new xmldb_field('enabledcapability', XMLDB_TYPE_TEXT, null, null, null, null, null);
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
$field = new xmldb_field('parameter', XMLDB_TYPE_TEXT, null, null, null, null, null);
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
$field = new xmldb_field('icon', XMLDB_TYPE_TEXT, null, null, null, null, null);
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
$field = new xmldb_field('secureicon', XMLDB_TYPE_TEXT, null, null, null, null, null);
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Lti savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2014061200, 'lti');
|
||||
}
|
||||
|
||||
if ($oldversion < 2014100300) {
|
||||
|
||||
mod_lti_upgrade_custom_separator();
|
||||
|
||||
// Lti savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2014100300, 'lti');
|
||||
}
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2016041800) {
|
||||
|
||||
// Define field description to be added to lti_types.
|
||||
|
||||
@@ -47,15 +47,6 @@ defined('MOODLE_INTERNAL') || die;
|
||||
function xmldb_page_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -33,138 +33,6 @@ function xmldb_quiz_upgrade($oldversion) {
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
if ($oldversion < 2014052800) {
|
||||
|
||||
// Define field completionattemptsexhausted to be added to quiz.
|
||||
$table = new xmldb_table('quiz');
|
||||
$field = new xmldb_field('completionattemptsexhausted', XMLDB_TYPE_INTEGER, '1', null, null, null, '0', 'showblocks');
|
||||
|
||||
// Conditionally launch add field completionattemptsexhausted.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
// Quiz savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2014052800, 'quiz');
|
||||
}
|
||||
|
||||
if ($oldversion < 2014052801) {
|
||||
// Define field completionpass to be added to quiz.
|
||||
$table = new xmldb_table('quiz');
|
||||
$field = new xmldb_field('completionpass', XMLDB_TYPE_INTEGER, '1', null, null, null, 0, 'completionattemptsexhausted');
|
||||
|
||||
// Conditionally launch add field completionpass.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Quiz savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2014052801, 'quiz');
|
||||
}
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2015030500) {
|
||||
// Define field requireprevious to be added to quiz_slots.
|
||||
$table = new xmldb_table('quiz_slots');
|
||||
$field = new xmldb_field('requireprevious', XMLDB_TYPE_INTEGER, '4', null, XMLDB_NOTNULL, null, 0, 'page');
|
||||
|
||||
// Conditionally launch add field page.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Quiz savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2015030500, 'quiz');
|
||||
}
|
||||
|
||||
if ($oldversion < 2015030900) {
|
||||
// Define field canredoquestions to be added to quiz.
|
||||
$table = new xmldb_table('quiz');
|
||||
$field = new xmldb_field('canredoquestions', XMLDB_TYPE_INTEGER, '4', null, XMLDB_NOTNULL, null, 0, 'preferredbehaviour');
|
||||
|
||||
// Conditionally launch add field completionpass.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Quiz savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2015030900, 'quiz');
|
||||
}
|
||||
|
||||
if ($oldversion < 2015032300) {
|
||||
|
||||
// Define table quiz_sections to be created.
|
||||
$table = new xmldb_table('quiz_sections');
|
||||
|
||||
// Adding fields to table quiz_sections.
|
||||
$table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
|
||||
$table->add_field('quizid', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('firstslot', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, null);
|
||||
$table->add_field('heading', XMLDB_TYPE_CHAR, '1333', null, null, null, null);
|
||||
$table->add_field('shufflequestions', XMLDB_TYPE_INTEGER, '4', null, XMLDB_NOTNULL, null, '0');
|
||||
|
||||
// Adding keys to table quiz_sections.
|
||||
$table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
|
||||
$table->add_key('quizid', XMLDB_KEY_FOREIGN, array('quizid'), 'quiz', array('id'));
|
||||
|
||||
// Adding indexes to table quiz_sections.
|
||||
$table->add_index('quizid-firstslot', XMLDB_INDEX_UNIQUE, array('quizid', 'firstslot'));
|
||||
|
||||
// Conditionally launch create table for quiz_sections.
|
||||
if (!$dbman->table_exists($table)) {
|
||||
$dbman->create_table($table);
|
||||
}
|
||||
|
||||
// Quiz savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2015032300, 'quiz');
|
||||
}
|
||||
|
||||
if ($oldversion < 2015032301) {
|
||||
|
||||
// Create a section for each quiz.
|
||||
$DB->execute("
|
||||
INSERT INTO {quiz_sections}
|
||||
(quizid, firstslot, heading, shufflequestions)
|
||||
SELECT id, 1, ?, shufflequestions
|
||||
FROM {quiz}
|
||||
", array(''));
|
||||
|
||||
// Quiz savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2015032301, 'quiz');
|
||||
}
|
||||
|
||||
if ($oldversion < 2015032302) {
|
||||
|
||||
// Define field shufflequestions to be dropped from quiz.
|
||||
$table = new xmldb_table('quiz');
|
||||
$field = new xmldb_field('shufflequestions');
|
||||
|
||||
// Conditionally launch drop field shufflequestions.
|
||||
if ($dbman->field_exists($table, $field)) {
|
||||
$dbman->drop_field($table, $field);
|
||||
}
|
||||
|
||||
// Quiz savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2015032302, 'quiz');
|
||||
}
|
||||
|
||||
if ($oldversion < 2015032303) {
|
||||
|
||||
// Drop corresponding admin settings.
|
||||
unset_config('shufflequestions', 'quiz');
|
||||
unset_config('shufflequestions_adv', 'quiz');
|
||||
|
||||
// Quiz savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2015032303, 'quiz');
|
||||
}
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2016032600) {
|
||||
// Update quiz_sections to repair quizzes what were broken by MDL-53507.
|
||||
$problemquizzes = $DB->get_records_sql("
|
||||
|
||||
@@ -31,15 +31,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_quiz_overview_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -30,15 +30,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_quiz_statistics_upgrade($oldversion) {
|
||||
global $DB;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -47,15 +47,6 @@ defined('MOODLE_INTERNAL') || die;
|
||||
function xmldb_resource_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -34,65 +34,6 @@ function xmldb_scorm_upgrade($oldversion) {
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
if ($oldversion < 2014072500) {
|
||||
|
||||
// Define field autocommit to be added to scorm.
|
||||
$table = new xmldb_table('scorm');
|
||||
$field = new xmldb_field('autocommit', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '0', 'displayactivityname');
|
||||
|
||||
// Conditionally launch add field autocommit.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Scorm savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2014072500, 'scorm');
|
||||
}
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2015031800) {
|
||||
|
||||
// Check to see if this site has any AICC packages - if so set the aiccuserid to pass the username
|
||||
// so that the data remains consistent with existing packages.
|
||||
$alreadyset = $DB->record_exists('config_plugins', array('plugin' => 'scorm', 'name' => 'aiccuserid'));
|
||||
if (!$alreadyset) {
|
||||
$hasaicc = $DB->record_exists('scorm', array('version' => 'AICC'));
|
||||
if ($hasaicc) {
|
||||
set_config('aiccuserid', 0, 'scorm');
|
||||
} else {
|
||||
// We set the config value to hide this from upgrades as most users will not know what AICC is anyway.
|
||||
set_config('aiccuserid', 1, 'scorm');
|
||||
}
|
||||
}
|
||||
// Scorm savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2015031800, 'scorm');
|
||||
}
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2015091400) {
|
||||
$table = new xmldb_table('scorm');
|
||||
|
||||
// Changing the default of field forcecompleted on table scorm to 0.
|
||||
$field = new xmldb_field('forcecompleted', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '0', 'maxattempt');
|
||||
// Launch change of default for field forcecompleted.
|
||||
$dbman->change_field_default($table, $field);
|
||||
|
||||
// Changing the default of field displaycoursestructure on table scorm to 0.
|
||||
$field = new xmldb_field('displaycoursestructure', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '0', 'displayattemptstatus');
|
||||
// Launch change of default for field displaycoursestructure.
|
||||
$dbman->change_field_default($table, $field);
|
||||
|
||||
// Scorm savepoint reached.
|
||||
upgrade_mod_savepoint(true, 2015091400, 'scorm');
|
||||
}
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// MDL-50620 Add mastery override option.
|
||||
if ($oldversion < 2016021000) {
|
||||
$table = new xmldb_table('scorm');
|
||||
|
||||
@@ -24,14 +24,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_survey_upgrade($oldversion) {
|
||||
global $DB;
|
||||
$dbman = $DB->get_manager(); // Loads ddl manager and xmldb classes.
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
@@ -47,15 +47,6 @@ defined('MOODLE_INTERNAL') || die;
|
||||
function xmldb_url_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -40,15 +40,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_wiki_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -37,15 +37,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_workshop_upgrade($oldversion) {
|
||||
global $CFG, $DB;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
if ($oldversion < 2016022200) {
|
||||
|
||||
@@ -33,15 +33,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_workshopform_accumulative_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -33,15 +33,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_workshopform_comments_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -33,15 +33,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_workshopform_numerrors_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -33,15 +33,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_workshopform_rubric_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -33,15 +33,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_portfolio_boxnet_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -23,15 +23,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_portfolio_googledocs_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -23,15 +23,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_portfolio_picasa_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -30,15 +30,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_qbehaviour_manualgraded_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -32,15 +32,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_qtype_calculated_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -31,36 +31,7 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @return bool
|
||||
*/
|
||||
function xmldb_qtype_ddmarker_upgrade($oldversion) {
|
||||
global $CFG, $DB;
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
// Moodle v2.3.0 release upgrade line
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.4.0 release upgrade line
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.5.0 release upgrade line
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2013053000) {
|
||||
|
||||
// Define field noofdrags to be added to qtype_ddmarker_drags.
|
||||
$table = new xmldb_table('qtype_ddmarker_drags');
|
||||
$field = new xmldb_field('noofdrags', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '1', 'infinite');
|
||||
|
||||
// Conditionally launch add field noofdrags.
|
||||
if (!$dbman->field_exists($table, $field)) {
|
||||
$dbman->add_field($table, $field);
|
||||
}
|
||||
|
||||
// Savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2013053000, 'qtype', 'ddmarker');
|
||||
}
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
global $CFG;
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
@@ -32,15 +32,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_qtype_essay_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -31,15 +31,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_qtype_match_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -30,99 +30,7 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @param int $oldversion the version we are upgrading from.
|
||||
*/
|
||||
function xmldb_qtype_multianswer_upgrade($oldversion) {
|
||||
global $CFG, $DB;
|
||||
|
||||
$dbman = $DB->get_manager();
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
if ($oldversion < 2015100201) {
|
||||
|
||||
// Upgrade steps need to be isolated from our APIs, so we should prevent using constants that
|
||||
// can change over time. This is a simple copy & paste from question/type/multianswer/questiontype.php
|
||||
// with the following changes, the idea is to prevent regressions as much as possible.
|
||||
// * All constants prefixed with UPGRADE_2015100201_
|
||||
// * Removed all constants not required by UPGRADE_2015100201_ANSWER_REGEX
|
||||
if (!defined('UPGRADE_2015100201_ANSWER_REGEX')) {
|
||||
define('UPGRADE_2015100201_ANSWER_ALTERNATIVE_FRACTION_REGEX',
|
||||
'=|%(-?[0-9]+)%');
|
||||
define('UPGRADE_2015100201_ANSWER_ALTERNATIVE_ANSWER_REGEX',
|
||||
'.+?(?<!\\\\|&|&)(?=[~#}]|$)');
|
||||
define('UPGRADE_2015100201_ANSWER_ALTERNATIVE_FEEDBACK_REGEX',
|
||||
'.*?(?<!\\\\)(?=[~}]|$)');
|
||||
define('UPGRADE_2015100201_ANSWER_ALTERNATIVE_REGEX',
|
||||
'(' . UPGRADE_2015100201_ANSWER_ALTERNATIVE_FRACTION_REGEX .')?' .
|
||||
'(' . UPGRADE_2015100201_ANSWER_ALTERNATIVE_ANSWER_REGEX . ')' .
|
||||
'(#(' . UPGRADE_2015100201_ANSWER_ALTERNATIVE_FEEDBACK_REGEX .'))?');
|
||||
|
||||
// Remaining ANSWER regexes.
|
||||
define('UPGRADE_2015100201_ANSWER_TYPE_DEF_REGEX',
|
||||
'(NUMERICAL|NM)|(MULTICHOICE|MC)|(MULTICHOICE_V|MCV)|(MULTICHOICE_H|MCH)|' .
|
||||
'(SHORTANSWER|SA|MW)|(SHORTANSWER_C|SAC|MWC)|' .
|
||||
'(MULTICHOICE_S|MCS)|(MULTICHOICE_VS|MCVS)|(MULTICHOICE_HS|MCHS)');
|
||||
define('UPGRADE_2015100201_ANSWER_START_REGEX',
|
||||
'\{([0-9]*):(' . UPGRADE_2015100201_ANSWER_TYPE_DEF_REGEX . '):');
|
||||
|
||||
define('UPGRADE_2015100201_ANSWER_REGEX',
|
||||
UPGRADE_2015100201_ANSWER_START_REGEX
|
||||
. '(' . UPGRADE_2015100201_ANSWER_ALTERNATIVE_REGEX
|
||||
. '(~'
|
||||
. UPGRADE_2015100201_ANSWER_ALTERNATIVE_REGEX
|
||||
. ')*)\}');
|
||||
|
||||
define('UPGRADE_2015100201_ANSWER_REGEX_ANSWER_TYPE_MULTICHOICE', 4);
|
||||
}
|
||||
|
||||
// Detect the exact table/field we want to use, coz can be different
|
||||
// depending of the version we are upgrading from. See MDL-52291 and MDL-52298.
|
||||
$multichoicetable = 'qtype_multichoice_options';
|
||||
$multichoicefield = 'questionid';
|
||||
if (!$dbman->table_exists($multichoicetable)) {
|
||||
// Multichoice not upgraded yet, let's use old names.
|
||||
$multichoicetable = 'question_multichoice';
|
||||
$multichoicefield = 'question';
|
||||
}
|
||||
$rs = $DB->get_recordset_sql("SELECT q.id, q.category, qma.sequence
|
||||
FROM {question} q
|
||||
JOIN {question_multianswer} qma ON q.id = qma.question");
|
||||
foreach ($rs as $q) {
|
||||
$sequence = preg_split('/,/', $q->sequence, -1, PREG_SPLIT_NO_EMPTY);
|
||||
if ($sequence) {
|
||||
// Get relevant data indexed by positionkey from the multianswers table.
|
||||
$wrappedquestions = $DB->get_records_list('question', 'id', $sequence, 'id ASC');
|
||||
foreach ($wrappedquestions as $wrapped) {
|
||||
if ($wrapped->qtype == 'multichoice') {
|
||||
$options = $DB->get_record($multichoicetable, array($multichoicefield => $wrapped->id), '*');
|
||||
if (isset($options->shuffleanswers)) {
|
||||
preg_match('/'.UPGRADE_2015100201_ANSWER_REGEX.'/s', $wrapped->questiontext, $answerregs);
|
||||
if (isset($answerregs[UPGRADE_2015100201_ANSWER_REGEX_ANSWER_TYPE_MULTICHOICE]) &&
|
||||
$answerregs[UPGRADE_2015100201_ANSWER_REGEX_ANSWER_TYPE_MULTICHOICE] !== '') {
|
||||
$DB->set_field($multichoicetable, 'shuffleanswers', '0',
|
||||
array('id' => $options->id) );
|
||||
}
|
||||
} else {
|
||||
$newrecord = new stdClass();
|
||||
$newrecord->$multichoicefield = $wrapped->id;
|
||||
$newrecord->correctfeedback = '';
|
||||
$newrecord->partiallycorrectfeedback = '';
|
||||
$newrecord->incorrectfeedback = '';
|
||||
$DB->insert_record($multichoicetable, $newrecord);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$rs->close();
|
||||
// Multianswer savepoint reached.
|
||||
upgrade_plugin_savepoint(true, 2015100201, 'qtype', 'multianswer');
|
||||
}
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
global $CFG;
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
@@ -32,15 +32,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_qtype_multichoice_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -32,15 +32,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_qtype_numerical_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -29,27 +29,7 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @param int $oldversion the version we are upgrading from.
|
||||
*/
|
||||
function xmldb_qtype_random_upgrade($oldversion) {
|
||||
global $CFG, $DB;
|
||||
|
||||
if ($oldversion < 2014060200) {
|
||||
$sql = "UPDATE {question}
|
||||
SET questiontext = '0'
|
||||
WHERE qtype = 'random'
|
||||
AND " . $DB->sql_compare_text('questiontext') . " = ?";
|
||||
$DB->execute($sql, array(''));
|
||||
|
||||
// Record that qtype_random savepoint was reached.
|
||||
upgrade_plugin_savepoint(true, 2014060200, 'qtype', 'random');
|
||||
}
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
global $CFG;
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
@@ -31,15 +31,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_qtype_randomsamatch_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -32,15 +32,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_qtype_shortanswer_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -33,15 +33,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_repository_boxnet_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -21,14 +21,7 @@ defined('MOODLE_INTERNAL') || die();
|
||||
* @return bool result
|
||||
*/
|
||||
function xmldb_repository_dropbox_upgrade($oldversion) {
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
global $CFG;
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
@@ -23,15 +23,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_repository_googledocs_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -23,15 +23,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_repository_picasa_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
@@ -33,15 +33,6 @@ defined('MOODLE_INTERNAL') || die();
|
||||
function xmldb_theme_more_upgrade($oldversion) {
|
||||
global $CFG;
|
||||
|
||||
// Moodle v2.8.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v2.9.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.0.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
// Moodle v3.1.0 release upgrade line.
|
||||
// Put any upgrade step following this.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user