trusttext cleaning in glossary upgrade - definitions and comments

This commit is contained in:
skodak 2006-08-26 18:08:18 +00:00
parent daed1a2f37
commit 907cf31821
3 changed files with 39 additions and 2 deletions

View File

@ -418,6 +418,24 @@ function glossary_upgrade($oldversion) {
$wtm->update( 'glossary_comments','text','format',$sql );
}
if ($oldversion < 2006082600) {
$sql1 = "UPDATE {$CFG->prefix}glossary_entries SET definition = REPLACE(definition, '".TRUSTTEXT."', '');";
$sql2 = "UPDATE {$CFG->prefix}glossary_comments SET comment = REPLACE(comment, '".TRUSTTEXT."', '');";
$likecond = sql_ilike()." '%".TRUSTTEXT."%'";
while (true) {
if (!count_records_select('glossary_entries', "definition $likecond")) {
break;
}
execute_sql($sql1);
}
while (true) {
if (!count_records_select('glossary_comments', "comment $likecond")) {
break;
}
execute_sql($sql2);
}
}
return true;
}

View File

@ -182,6 +182,25 @@ function glossary_upgrade($oldversion) {
table_column('glossary','allowprintview','allowprintview','smallint','4','unsigned','1');
}
if ($oldversion < 2006082600) {
$sql1 = "UPDATE {$CFG->prefix}glossary_entries SET definition = REPLACE(definition, '".TRUSTTEXT."', '');";
$sql2 = "UPDATE {$CFG->prefix}glossary_comments SET comment = REPLACE(comment, '".TRUSTTEXT."', '');";
$likecond = sql_ilike()." '%".TRUSTTEXT."%'";
while (true) {
if (!count_records_select('glossary_entries', "definition $likecond")) {
break;
}
execute_sql($sql1);
}
while (true) {
if (!count_records_select('glossary_comments', "comment $likecond")) {
break;
}
execute_sql($sql2);
}
}
return true;
}

View File

@ -5,8 +5,8 @@
/// This fragment is called by moodle_needs_upgrading() and /admin/index.php
/////////////////////////////////////////////////////////////////////////////////
$module->version = 2006080900;
$module->requires = 2006080900; // Requires this Moodle version
$module->version = 2006082600;
$module->requires = 2006082600; // Requires this Moodle version
$module->cron = 0; // Period for cron to check this module (secs)
?>