Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Backup: Difference between revisions

From MoodleDocs
(redirect as suggested by Andrew N)
 
Line 1: Line 1:
{{stub}}
#redirect [[Backup_2.0_for_developers]]
''Please add backup and restore documentation for new developers here...''
== Back Up for your Module ==
Your backup functions should sit in a file called backuplib.php in your module folder. As a minimum you should write the following functions:
*''' ''MODULENAME''_backup_mods($bf,$preferences) ''' - backs up all instances of your module
*''' ''MODULENAME''_backup_one_mod($bf,$preferences,$scefcentre) ''' - backs up a single instance of your module
*''' ''MODULENAME''_check_backup_mods($course,$user_data=false,$backup_unique_code,$instances=null) ''' - generates an array of course and user data information used to select which instances to backup (and whether to include user data or not). This includes details at [0][0] and [0][1] about the course module name and number of instances for the course and at [1][0] and [1][1] with the module name and count of user information.
*''' ''MODULENAME''_check_backup_mods_instances($instance,$backup_unique_code) ''' - generates an array of course and user data information for a specific instance.
*''' ''MODULENAME''_encode_content_links ($content,$preferences) ''' - recode links to ensure they work when reimported.
 
''MODULENAME''_backup_one_mod should generate XML output by calling the fwrite() function. This XML should cover all fields in the database:
 
<code php>
//Start mod
fwrite ($bf,start_tag("MOD",3,true));
 
//generate XML representing the DB
fwrite ($bf,full_tag("ID",4,false, 'VALUE_GOES_HERE'));
fwrite ($bf,full_tag("TEXT",4,false, 'VALUE_GOES_HERE'));
 
//End mod
$status =fwrite ($bf,end_tag("MOD",3,true));
</code>
 
==See also==
 
*[[Backup 2.0 for developers]]
*[[Backup and restore FAQ]]
*Using Moodle [http://moodle.org/mod/forum/view.php?f=128 Backup and Restore forum]
 
Using Moodle forum discussions:
*[http://moodle.org/mod/forum/discuss.php?d=86837 Third-party module backup]
 
[[Category:Backup]]

Latest revision as of 16:06, 3 January 2013