2003-05-03 23:19:07 +00:00
|
|
|
<?PHP //$Id$
|
|
|
|
//
|
|
|
|
// This file keeps track of upgrades to Moodle's
|
|
|
|
// backup/restore utility.
|
|
|
|
//
|
|
|
|
// 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.
|
|
|
|
//
|
|
|
|
// Versions are defined by backup_version.php
|
|
|
|
//
|
|
|
|
// This file is tailored to MySQL
|
|
|
|
|
|
|
|
function backup_upgrade($oldversion=0) {
|
|
|
|
|
|
|
|
global $CFG;
|
|
|
|
|
|
|
|
$result = true;
|
|
|
|
|
|
|
|
if ($oldversion < 2003050300 and $result) {
|
|
|
|
$result = execute_sql("CREATE TABLE `{$CFG->prefix}backup_ids` (
|
|
|
|
`backup_code` INT(12) UNSIGNED NOT NULL,
|
|
|
|
`table_name` VARCHAR(30) NOT NULL,
|
|
|
|
`old_id` INT(10) UNSIGNED NOT NULL,
|
|
|
|
`new_id` INT(10) UNSIGNED,
|
|
|
|
PRIMARY KEY (`backup_code`, `table_name`, `old_id`)
|
|
|
|
)
|
|
|
|
COMMENT = 'To store and convert ids in backup/restore'");
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($oldversion < 2003050301 and $result) {
|
|
|
|
$result = execute_sql("ALTER TABLE `{$CFG->prefix}backup_ids`
|
2003-05-04 01:10:20 +00:00
|
|
|
ADD `info` VARCHAR(30)");
|
2003-05-04 21:01:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ($oldversion < 2003050400 and $result) {
|
|
|
|
$result = execute_sql("ALTER TABLE `{$CFG->prefix}backup_ids`
|
|
|
|
MODIFY `info` VARCHAR(255)");
|
2003-05-03 23:19:07 +00:00
|
|
|
}
|
|
|
|
|
2003-05-04 21:01:47 +00:00
|
|
|
if ($oldversion < 2003050401 and $result) {
|
|
|
|
$result = execute_sql("CREATE TABLE `{$CFG->prefix}backup_files` (
|
|
|
|
`backup_code` INT( 10 ) UNSIGNED NOT NULL ,
|
|
|
|
`file_type` VARCHAR( 10 ) NOT NULL ,
|
|
|
|
`path` VARCHAR( 255 ) NOT NULL ,
|
|
|
|
`old_id` INT( 10 ) UNSIGNED,
|
|
|
|
`new_id` INT( 10 ) UNSIGNED,
|
|
|
|
PRIMARY KEY ( `backup_code` , `file_type` , `path` )
|
|
|
|
) COMMENT = 'To store and recode ids to user & course files.'");
|
|
|
|
}
|
2003-05-03 23:19:07 +00:00
|
|
|
|
|
|
|
//Finally, return result
|
|
|
|
return $result;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|