Browse files

Now glossary module backups from a 1.4 version can be restored in a 1.3.

Only two combinations aren't 100% compatible:
    - Program resources.
    - Text without format in 1.4 is changed to type 4 (plain text)
Bug 1676
(http://moodle.org/bugs/bug.php?op=show&bugid=1676)
  • Loading branch information...
1 parent 3ce0b09 commit 2ca880899cad3188ea56ee9968a1322cd1459ef7 stronk7 committed Jul 29, 2004
Showing with 24 additions and 0 deletions.
  1. +24 −0 mod/glossary/restorelib.php
View
24 mod/glossary/restorelib.php
@@ -79,6 +79,30 @@ function glossary_restore_mods($mod,$restore) {
}
}
+ //We are going to mantain here backwards compatibility with 1.4 glossaries (exception!!)
+ //so we have to make some conversions
+ //If the displayformat field isn't numeric we are restoring a newer (1.4) glossary
+ if (!is_numeric($glossary->displayformat)) {
+ //Hardcode the conversions
+ if ($glossary->displayformat == 'dictionary') {
+ $glossary->displayformat = '0';
+ } else if ($glossary->displayformat == 'continuous') {
+ $glossary->displayformat = '1';
+ } else if ($glossary->displayformat == 'fullwithauthor') {
+ $glossary->displayformat = '2';
+ } else if ($glossary->displayformat == 'encyclopedia') {
+ $glossary->displayformat = '3';
+ } else if ($glossary->displayformat == 'faq') {
+ $glossary->displayformat = '4';
+ } else if ($glossary->displayformat == 'fullwithoutauthor') {
+ $glossary->displayformat = '5';
+ } else if ($glossary->displayformat == 'entrylist') {
+ $glossary->displayformat = '6';
+ } else {
+ $glossary->displayformat = '0';
+ }
+ }
+
//The structure is equal to the db, so insert the glossary
$newid = insert_record ("glossary",$glossary);

0 comments on commit 2ca8808

Please sign in to comment.