Library to every functions related with the backup/restore matter

This commit is contained in:
stronk7 2003-05-03 23:20:38 +00:00
parent 04aa5b2de1
commit afbe3de8cf

31
backup/lib.php Normal file
View File

@ -0,0 +1,31 @@
<?PHP //$Id$
//This file contains all the function needed in the backup/restore utility
//except the mod-related funtions that are into every backuplib.php inside
//every mod directory
//Insert necessary category ids to backup_ids table
function insert_category_ids ($course,$backup_unique_code) {
global $CFG;
$status = true;
$status = execute_sql("INSERT INTO {$CFG->prefix}backup_ids
(backup_code, table_name, old_id)
SELECT DISTINCT '$backup_unique_code','quiz_categories',t.category
FROM {$CFG->prefix}quiz_questions t,
{$CFG->prefix}quiz_question_grades g,
{$CFG->prefix}quiz q
WHERE q.course = '$course' AND
g.quiz = q.id AND
g.question = t.id",false);
return $status;
}
//Delete category ids from backup_ids table
function delete_category_ids ($backup_unique_code) {
global $CFG;
$status = true;
$status = execute_sql("DELETE FROM {$CFG->prefix}backup_ids
WHERE backup_code = '$backup_unique_code'",false);
return $status;
}
?>