]> git.mjollnir.org Git - moodle.git/commitdiff
Now upgrade and restore processes enable editalways for old
authorstronk7 <stronk7>
Mon, 9 Aug 2004 19:20:42 +0000 (19:20 +0000)
committerstronk7 <stronk7>
Mon, 9 Aug 2004 19:20:42 +0000 (19:20 +0000)
secondary glossaries. Smooth transition. Thanks, Martin! :-)

Bug 1445
(http://moodle.org/bugs/bug.php?op=show&bugid=1445)

mod/glossary/db/mysql.php
mod/glossary/db/postgres7.php
mod/glossary/restorelib.php
mod/glossary/version.php

index f6761302458e18fd5b223b294da82c01297305cd..145e5dd1570f4701e5b2317f482988e85448b566 100644 (file)
@@ -339,6 +339,11 @@ function glossary_upgrade($oldversion) {
   if ( $oldversion < 2004080800) {
       table_column("glossary","","editalways","tinyint","2", "unsigned", "0", "", "entbypage");
   }
+
+  //Activate editalways in old secondary glossaries (old behaviour)
+  if ( $oldversion < 2004080900) {
+      set_field('glossary','editalways','1','mainglossary','0');
+  }
     
   return true;
 }
index 2a4b458b2586daa238a6f156fe45d4c67e2d9514..0921803dd2120ca15ea6f57f42de751280171bf2 100644 (file)
@@ -101,6 +101,11 @@ function glossary_upgrade($oldversion) {
       table_column("glossary","","editalways","integer","2", "unsigned", "0", "", "entbypage");
   }
 
+  //Activate editalways in old secondary glossaries (old behaviour)
+  if ( $oldversion < 2004080900) {
+      set_field('glossary','editalways','1','mainglossary','0');
+  }
+
   return true;
 }
 
index 130b031c2dc29cb0337acae6848510181c405532..e5b80b228364d27f9db4497e834cbd875d61fefb 100644 (file)
                 $glossary->displayformat = 'dictionary';
             }
 
+            //If the backup file doesn't include the editalways field, activate it
+            //in secondary glossaries (old behaviour, pre 1.4)
+            if (! isset($info['MOD']['#']['EDITALWAYS']['0']['#'])) { //It's a pre-14 backup file
+                if ($glossary->mainglossary == '0') {
+                    $glossary->editalways = '1';
+                }
+            }
+
             //The structure is equal to the db, so insert the glossary
             $newid = insert_record ("glossary",$glossary);
 
index 89df5f8abeb0471047a13339464036a20f95a2db..f19361e7fb6e003daa2aefcb1e616cddb3bcd6e2 100644 (file)
@@ -5,7 +5,7 @@
 ///  This fragment is called by moodle_needs_upgrading() and /admin/index.php
 /////////////////////////////////////////////////////////////////////////////////
 
-$module->version  = 2004080800;  // The current module version (Date: YYYYMMDDXX)
+$module->version  = 2004080900;  // The current module version (Date: YYYYMMDDXX)
 $module->requires = 2004080300;  // Requires this Moodle version
 $module->cron     = 0;           // Period for cron to check this module (secs)