mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 21:49:15 +01:00
MDL-75346 core_my: Handle missing blocks on reset
If the default dashboard contained a block that was missing from disk then "Exception - Call to a member function instance_copy() on bool" was shown to users. This change only shows an error with debugging enabled which now includes the name of the missing block.
This commit is contained in:
parent
5019abfdd6
commit
199ce65ec0
@ -121,9 +121,10 @@ function my_copy_page(
|
||||
$newblockinstanceids[$originalid] = $instance->id;
|
||||
$blockcontext = context_block::instance($instance->id); // Just creates the context record
|
||||
$block = block_instance($instance->blockname, $instance);
|
||||
if (!$block->instance_copy($originalid)) {
|
||||
debugging("Unable to copy block-specific data for original block instance: $originalid
|
||||
to new block instance: $instance->id", DEBUG_DEVELOPER);
|
||||
if (empty($block) || !$block->instance_copy($originalid)) {
|
||||
debugging("Unable to copy block-specific data for original block
|
||||
instance: $originalid to new block instance: $instance->id for
|
||||
block: $instance->blockname", DEBUG_DEVELOPER);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user