From d19e8195970bbdf1e35b28b56bfe25a54819ee1b Mon Sep 17 00:00:00 2001 From: tjhunt Date: Thu, 7 May 2009 02:56:48 +0000 Subject: [PATCH] blocklib: MDL-19010 move the check for whether the right database tables exist to a place where it is better encapsulated. --- lib/blocklib.php | 8 +++++++- lib/pagelib.php | 5 +---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/blocklib.php b/lib/blocklib.php index 5678b66874..a873e4ac09 100644 --- a/lib/blocklib.php +++ b/lib/blocklib.php @@ -247,12 +247,18 @@ class block_manager implements ArrayAccess { * This method actually loads the blocks for our page from the database. */ public function load_blocks($includeinvisible = NULL) { - global $DB; + global $DB, $CFG; if (!is_null($this->birecordsbyregion)) { // Already done. return; } + if ($CFG->version < 2009050619) { + // Upgrade/install not complete. Don't try too show any blocks. + $this->birecordsbyregion = array(); + return; + } + if (is_null($includeinvisible)) { $includeinvisible = $this->page->user_is_editing(); } diff --git a/lib/pagelib.php b/lib/pagelib.php index 87d80b8a9f..3c9070d19e 100644 --- a/lib/pagelib.php +++ b/lib/pagelib.php @@ -580,10 +580,7 @@ class moodle_page { } $this->initialise_standard_body_classes(); - - if ($CFG->version >= 2009050619) { - $this->blocks->load_blocks(); - } + $this->blocks->load_blocks(); } /** -- 2.39.5