From 848db616367516ce78e45331b45db87f7558223c Mon Sep 17 00:00:00 2001 From: Damyon Wiese Date: Tue, 25 Oct 2016 08:30:59 +0800 Subject: [PATCH] MDL-56006 blocks: Fix installation with no required blocks Boost requires no blocks which was causing a failure on installation. --- lib/blocklib.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/blocklib.php b/lib/blocklib.php index 37b560465f4..0cd4c4610a8 100644 --- a/lib/blocklib.php +++ b/lib/blocklib.php @@ -373,6 +373,8 @@ class block_manager { if ($undeletableblocks === false) { return array('navigation','settings'); + } else if ($undeletableblocks === '') { + return array(); } else if (is_string($undeletableblocks)) { return explode(',', $undeletableblocks); } else { @@ -958,6 +960,7 @@ class block_manager { */ public function create_all_block_instances() { global $PAGE; + $missing = false; // If there are any un-removable blocks that were not created - force them. $undeletable = $this->get_undeletable_block_types(); @@ -975,8 +978,15 @@ class block_manager { } if (!$found) { $this->add_block_at_end_of_default_region($forced); + $missing = true; } } + + if ($missing) { + // Some blocks were missing. Lets do it again. + $this->birecordsbyregion = null; + $this->load_blocks(); + } foreach ($this->get_regions() as $region) { $this->ensure_instances_exist($region); }