2006-10-04 09:47:05 +00:00
|
|
|
<?PHP //$Id$
|
|
|
|
|
|
|
|
// This file keeps track of upgrades to Moodle.
|
|
|
|
//
|
|
|
|
// Sometimes, changes between versions involve
|
|
|
|
// alterations to database structures and other
|
|
|
|
// major things that may break installations.
|
|
|
|
//
|
|
|
|
// The upgrade function in this file will attempt
|
|
|
|
// to perform all the necessary actions to upgrade
|
|
|
|
// your older installtion to the current version.
|
|
|
|
//
|
|
|
|
// If there's something it cannot do itself, it
|
|
|
|
// will tell you what you need to do.
|
|
|
|
//
|
|
|
|
// The commands in here will all be database-neutral,
|
|
|
|
// using the functions defined in lib/ddllib.php
|
|
|
|
|
|
|
|
|
|
|
|
function xmldb_main_upgrade($oldversion=0) {
|
|
|
|
|
2007-01-05 08:51:14 +00:00
|
|
|
global $CFG, $THEME, $USER, $db;
|
2006-10-04 09:47:05 +00:00
|
|
|
|
|
|
|
$result = true;
|
|
|
|
|
2008-05-01 20:29:04 +00:00
|
|
|
////////////////////////////////////////
|
|
|
|
///upgrade supported only from 1.9.x ///
|
|
|
|
////////////////////////////////////////
|
2008-02-21 09:27:11 +00:00
|
|
|
|
2008-03-07 13:23:38 +00:00
|
|
|
if ($result && $oldversion < 2008030700) {
|
|
|
|
|
|
|
|
/// Define index contextid-lowerboundary (not unique) to be dropped form grade_letters
|
|
|
|
$table = new XMLDBTable('grade_letters');
|
|
|
|
$index = new XMLDBIndex('contextid-lowerboundary');
|
|
|
|
$index->setAttributes(XMLDB_INDEX_NOTUNIQUE, array('contextid', 'lowerboundary'));
|
|
|
|
|
|
|
|
/// Launch drop index contextid-lowerboundary
|
|
|
|
$result = $result && drop_index($table, $index);
|
|
|
|
|
|
|
|
/// Define index contextid-lowerboundary-letter (unique) to be added to grade_letters
|
|
|
|
$table = new XMLDBTable('grade_letters');
|
|
|
|
$index = new XMLDBIndex('contextid-lowerboundary-letter');
|
|
|
|
$index->setAttributes(XMLDB_INDEX_UNIQUE, array('contextid', 'lowerboundary', 'letter'));
|
|
|
|
|
|
|
|
/// Launch add index contextid-lowerboundary-letter
|
|
|
|
$result = $result && add_index($table, $index);
|
|
|
|
|
|
|
|
/// Main savepoint reached
|
2008-04-18 23:15:44 +00:00
|
|
|
upgrade_main_savepoint($result, 2008030700);
|
|
|
|
}
|
2008-03-07 13:23:38 +00:00
|
|
|
|
2008-05-01 20:29:04 +00:00
|
|
|
if ($result && $oldversion < 2008050100) {
|
|
|
|
// Update courses that used weekscss to weeks
|
|
|
|
$result = set_field('course', 'format', 'weeks', 'format', 'weekscss');
|
|
|
|
upgrade_main_savepoint($result, 2008050100);
|
|
|
|
}
|
|
|
|
|
2008-05-02 09:42:43 +00:00
|
|
|
if ($result && $oldversion < 2008050200) {
|
|
|
|
// remove unused config options
|
|
|
|
unset_config('statsrolesupgraded');
|
|
|
|
upgrade_main_savepoint($result, 2008050200);
|
|
|
|
}
|
|
|
|
|
2007-06-20 23:06:29 +00:00
|
|
|
return $result;
|
2006-10-04 09:47:05 +00:00
|
|
|
}
|
2007-08-09 21:51:09 +00:00
|
|
|
|
|
|
|
|
2006-10-04 09:47:05 +00:00
|
|
|
?>
|