From 9120630b4bbff92d32e23b04b796abe38ad914b7 Mon Sep 17 00:00:00 2001 From: stronk7 Date: Sun, 27 Apr 2008 01:56:08 +0000 Subject: [PATCH] glossary->id for block is now properly recoded by restore. MDL-4934 ; merged from 19_STABLE --- blocks/glossary_random/block_glossary_random.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/blocks/glossary_random/block_glossary_random.php b/blocks/glossary_random/block_glossary_random.php index 795fe51807..855ae7df57 100644 --- a/blocks/glossary_random/block_glossary_random.php +++ b/blocks/glossary_random/block_glossary_random.php @@ -226,5 +226,17 @@ class block_glossary_random extends block_base { return false; } + /** + * Executed after block instance has been created, we use it to recode + * the glossary config setting to point to the new (restored) one + */ + function after_restore($restore) { + /// We need to transform the glossary->id from the original one to the restored one + if ($rec = backup_getid($restore->backup_unique_code, 'glossary', $this->config->glossary)) { + $this->config->glossary = $rec->new_id; + $this->instance_config_commit(); + } + } + } ?> -- 2.39.5