From 932f299bc0cf55c24a294d1d2fba7dde466e1a36 Mon Sep 17 00:00:00 2001 From: Mark Nelson Date: Tue, 20 Dec 2016 16:42:43 +0800 Subject: [PATCH] MDL-57437 core: upgrade code for introduction of block_myoverview Part of MDL-55611 epic. --- lib/blocklib.php | 2 +- lib/db/upgrade.php | 10 ++++++++++ version.php | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/blocklib.php b/lib/blocklib.php index 296c55d4bba..f002c4ce7e3 100644 --- a/lib/blocklib.php +++ b/lib/blocklib.php @@ -2537,6 +2537,6 @@ function blocks_add_default_system_blocks() { } $newblocks = array('private_files', 'online_users', 'badges', 'calendar_month', 'calendar_upcoming'); - $newcontent = array('lp', 'course_overview'); + $newcontent = array('lp', 'myoverview'); $page->blocks->add_blocks(array(BLOCK_POS_RIGHT => $newblocks, 'content' => $newcontent), 'my-index', $subpagepattern); } diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index 69ef988fa08..c86c6cb432e 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -2611,5 +2611,15 @@ function xmldb_main_upgrade($oldversion) { upgrade_main_savepoint(true, 2017031400.00); } + if ($oldversion < 2017040300.04) { + + // If the 'Course overview' block is no longer present, replace with the 'My overview' block. + if (!file_exists($CFG->dirroot . '/blocks/course_overview/block_course_overview.php')) { + $DB->set_field('block_instances', 'blockname', 'myoverview', array('blockname' => 'course_overview')); + } + + upgrade_main_savepoint(true, 2017040300.04); + } + return true; } diff --git a/version.php b/version.php index f8fd9032855..9589ae0e0fb 100644 --- a/version.php +++ b/version.php @@ -29,7 +29,7 @@ defined('MOODLE_INTERNAL') || die(); -$version = 2017033100.00; // YYYYMMDD = weekly release date of this DEV branch. +$version = 2017040300.04; // YYYYMMDD = weekly release date of this DEV branch. // RR = release increments - 00 in DEV branches. // .XX = incremental changes.