MDL-19124 Make sure upgrading sites get the default blocks

This commit is contained in:
Martin Dougiamas
2010-05-04 13:20:29 +00:00
parent 03d9401e7d
commit 2290399ee8
2 changed files with 13 additions and 3 deletions
+12 -2
View File
@@ -3928,7 +3928,7 @@ AND EXISTS (SELECT 'x'
}
if ($result && $oldversion < 2010050400) { // my_pages for My Moodle and Public Profile pages
if ($result && $oldversion < 2010050401) { // my_pages for My Moodle and Public Profile pages
/// Define table my_pages to be created
$table = new xmldb_table('my_pages');
@@ -3966,8 +3966,18 @@ AND EXISTS (SELECT 'x'
$result = $result && $DB->insert_record('my_pages', $mypage);
}
if ($defaultmypage = $DB->get_record('my_pages', array('userid'=>null, 'name'=>'__default', 'private'=>1))) {
$subpagepattern = $defaultmypage->id;
} else {
$subpagepattern = null;
}
$page = new moodle_page();
$page->set_context(get_context_instance(CONTEXT_SYSTEM));
$page->blocks->add_blocks(array(BLOCK_POS_RIGHT => array('myprofile', 'private_files', 'online_users'), 'content' => array('course_overview')), 'my-index', $subpagepattern, false);
/// Main savepoint reached
upgrade_main_savepoint($result, 2010050400);
upgrade_main_savepoint($result, 2010050401);
}
+1 -1
View File
@@ -6,7 +6,7 @@
// This is compared against the values stored in the database to determine
// whether upgrades should be performed (see lib/db/*.php)
$version = 2010050400; // YYYYMMDD = date of the last version bump
$version = 2010050401; // YYYYMMDD = date of the last version bump
// XX = daily increments
$release = '2.0 dev (Build: 20100504)'; // Human-friendly version name