Backup and Admin Functions?

Backup and Admin Functions?

by Mike Churchward -
Number of replies: 6
Picture of Core developers Picture of Plugin developers Picture of Testers

Can someone point me to what I need to do to:

  1. Add backup functionality to a module, and
  2. Add an admin option ifor a module on the admin/configure/modules screen.

Thanks,

mike

Average of ratings: -
In reply to Mike Churchward

Re: Backup and Admin Functions?

by Eloy Lafuente (stronk7) -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Peer reviewers Picture of Plugin developers Picture of Testers
Hi Mike,

about how to implement the backup for a new module, perhaps this link will help you: http://moodle.org/mod/forum/discuss.php?d=6377 . I think the best recommendation (after reading that general guidelines) is to take a look to some simple module in Moodle (assignment could be a good candidate, with files support) to see the backuplib.php and restorelib.php files and understand what is happening there. Anyway, after work a bit yourself...if you have any question and I can help you, I'm here wink !!

about how to implement the configure option for a module, one config.html must exist under your mod/XXXX directory. This will make that, automatically, the Config link will appear under Administration/Modules. In that config.html file you should implement a form, with your needed fields. To be "compatible" with the rest of the modules you must be sure that *every* field in that form is named "XXXXX_YYYYY", where XXXX is the name of your module (one English descriptive word) and YYYY is the name of the variable that you want to store. The form will call module.php and automatically that script (no action required) will store all that field contents into the mdl_config table. Then you can access to that variables against the $CFG global object. Again, the best recommendation is to read and understand some existing config.php file and to see what's happening in mdl_config table when you use it.

Hope this helps...

Ciao smile
In reply to Mike Churchward

Re: Backup and Admin Functions?

by Daryl Hawes -
In my conitnued work in porting Simplog to a moodle module I had this same question. There should be a module file in the template called "config.html". Moodle uses this file as the admin/configure/modules screen as I recall.
I copied the config.html file from the forum mod and used it as a starting point/template.
In reply to Mike Churchward

Re: Backup and Admin Functions?

by Michael Schneider -
You need 2 files: backuplib.php and restorelib.php. There you can backup/restore the database and the files...
In reply to Michael Schneider

Re: Backup and Admin Functions?

by Mike Churchward -
Picture of Core developers Picture of Plugin developers Picture of Testers

Michael -

I guess you already did this for the wiki then, eh? smile

mike

In reply to Mike Churchward

Re: Backup and Admin Functions?

by Michael Schneider -
Yup smile... I have to check if it is still in sync with the database, but it is done...
In reply to Mike Churchward

Re: Backup and Admin Functions?

by W Page -
Mike,

That was a really good Moodle coding question.

Thanks for asking it.

WP1