Now upgrade and restore processes enable editalways for old

secondary glossaries. Smooth transition. Thanks, Martin! :-)

Bug 1445
(http://moodle.org/bugs/bug.php?op=show&bugid=1445)
This commit is contained in:
stronk7 2004-08-09 19:20:42 +00:00
parent f8559be0fc
commit cd2bf3309c
4 changed files with 19 additions and 1 deletions

View 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;
}

View 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;
}

View File

@ -100,6 +100,14 @@
$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);

View 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)