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

This commit is contained in:
Paul Holden
2024-08-07 04:13:54 +00:00
committed by Jenkins
parent 01375bdaa0
commit 0b4100c13e
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.