mirror of
https://github.com/moodle/moodle.git
synced 2025-04-22 08:55:15 +02:00
MDL-18541 replace script - now also replaces within well known html blocks. Merged from 19_STABLE
This commit is contained in:
parent
c49e414b79
commit
36fa17855f
@ -40,6 +40,20 @@ if (!db_replace($search, $replace)) {
|
||||
|
||||
print_simple_box_end();
|
||||
|
||||
/// Try to replace some well-known serialised contents (html blocks)
|
||||
notify('Replacing in html blocks...');
|
||||
$sql = "SELECT bi.*
|
||||
FROM {$CFG->prefix}block_instance bi
|
||||
JOIN {$CFG->prefix}block b ON b.id = bi.blockid
|
||||
WHERE b.name = 'html'";
|
||||
if ($instances = $DB->get_records_sql($sql)) {
|
||||
foreach ($instances as $instance) {
|
||||
$blockobject = block_instance('html', $instance);
|
||||
$blockobject->config->text = str_replace($search, $replace, $blockobject->config->text);
|
||||
$blockobject->instance_config_commit($blockobject->pinned);
|
||||
}
|
||||
}
|
||||
|
||||
/// Rebuild course cache which might be incorrect now
|
||||
notify('Rebuilding course cache...', 'notifysuccess');
|
||||
rebuild_course_cache();
|
||||
|
Loading…
x
Reference in New Issue
Block a user