MDL-82392 blocks: consistent cleaning of block instance names.

This commit is contained in:
Paul Holden
2024-08-02 01:33:18 +00:00
committed by Jenkins
parent 00b1e807ab
commit 97866086d3
4 changed files with 9 additions and 13 deletions
+3 -5
View File
@@ -176,11 +176,9 @@ class block extends base {
if ($block = $DB->get_record('block', array('name'=>$this->name))) {
// Inform block it's about to be deleted.
if (file_exists("$CFG->dirroot/blocks/$block->name/block_$block->name.php")) {
$blockobject = block_instance($block->name);
if ($blockobject) {
$blockobject->before_delete(); // Only if we can create instance, block might have been already removed.
}
$blockobject = block_instance($block->name);
if ($blockobject) {
$blockobject->before_delete(); // Only if we can create instance, block might have been already removed.
}
// First delete instances and related contexts.