mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
trusttext cleaning in glossary upgrade - definitions and comments
This commit is contained in:
parent
daed1a2f37
commit
907cf31821
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
||||
?>
|
||||
|
Loading…
x
Reference in New Issue
Block a user