From 4e65d23fd1ebd25e1763ceb05ed7c9619fcc88d6 Mon Sep 17 00:00:00 2001 From: moodler Date: Mon, 30 Aug 2004 15:57:09 +0000 Subject: [PATCH] OK, this should finally fix the block upgrading problem. The problem was that site_admin_menu had not been added to the database yet when we tried to update the blockinfo for the site. --- blocks/db/mysql.php | 7 ------- blocks/db/postgres7.php | 7 ------- lib/blocklib.php | 5 +++++ 3 files changed, 5 insertions(+), 14 deletions(-) diff --git a/blocks/db/mysql.php b/blocks/db/mysql.php index 9fbde6a4e14..cdf3efb2b43 100644 --- a/blocks/db/mysql.php +++ b/blocks/db/mysql.php @@ -37,13 +37,6 @@ global $CFG; COMMENT = 'To register and update all the available blocks'"); } - if (!empty($CFG->siteblocksadded)) { /// Set by main Moodle upgrade - // Add blockinfo to the site course - require_once($CFG->dirroot.'/lib/blocklib.php'); - $site = get_site(); - blocks_get_default_blocks($site->id, BLOCKS_DEFAULT_SITE); - delete_records('config', 'name', 'siteblocksadded'); - } //Finally, return result return $result; diff --git a/blocks/db/postgres7.php b/blocks/db/postgres7.php index 825b4293734..174fcb194c1 100644 --- a/blocks/db/postgres7.php +++ b/blocks/db/postgres7.php @@ -39,13 +39,6 @@ global $CFG; } - if (!empty($CFG->siteblocksadded)) { /// Set by main Moodle upgrade - // Add blockinfo to the site course - require_once($CFG->dirroot.'/lib/blocklib.php'); - $site = get_site(); - blocks_get_default_blocks($site->id, BLOCKS_DEFAULT_SITE); - delete_records('config', 'name', 'siteblocksadded'); - } //Finally, return result return $result; diff --git a/lib/blocklib.php b/lib/blocklib.php index 4dbd7442387..f0fc6180b7d 100644 --- a/lib/blocklib.php +++ b/lib/blocklib.php @@ -705,6 +705,11 @@ function upgrade_blocks_plugins($continueto) { } } + if (!empty($CFG->siteblocksadded)) { /// This is a once-off hack to make a proper upgrade + blocks_get_default_blocks(SITEID, BLOCKS_DEFAULT_SITE); // Add blockinfo to the site course + delete_records('config', 'name', 'siteblocksadded'); + } + if (!empty($updated_blocks)) { print_continue($continueto); die;