From 58ec5a315b16f3ebc45197833930100345f6fd7d Mon Sep 17 00:00:00 2001 From: Damyon Wiese Date: Mon, 28 Nov 2016 14:46:32 +0800 Subject: [PATCH] MDL-57176 blocks: Never never never dup blocks Dont create duplicate blocks 'requiredbytheme' for any reason. --- lib/blocklib.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/blocklib.php b/lib/blocklib.php index fb862e8c454..4990a2e5aa0 100644 --- a/lib/blocklib.php +++ b/lib/blocklib.php @@ -1053,6 +1053,11 @@ class block_manager { return; } + // Never add a duplicate block required by theme. + if ($DB->record_exists('block_instances', array('blockname' => $blockname, 'requiredbytheme' => 1))) { + return; + } + $systemcontext = context_system::instance(); $defaultregion = $this->get_default_region(); // Add a special system wide block instance only for themes that require it.