From 856b6fe6d28eedb69d40d216a74e404715983de3 Mon Sep 17 00:00:00 2001 From: nicolasconnault Date: Wed, 1 Jul 2009 08:49:47 +0000 Subject: [PATCH] MDL-19676 Removed course and group visibility settings for blog --- blocks/blog_menu/block_blog_menu.php | 243 ++++++++++++++++++++++---- blocks/blog_tags/block_blog_tags.php | 12 +- blog/index.php | 252 ++++++++++++++++----------- lib/db/upgrade.php | 43 +++++ 4 files changed, 398 insertions(+), 152 deletions(-) diff --git a/blocks/blog_menu/block_blog_menu.php b/blocks/blog_menu/block_blog_menu.php index 2967304084..6bd9415530 100755 --- a/blocks/blog_menu/block_blog_menu.php +++ b/blocks/blog_menu/block_blog_menu.php @@ -1,6 +1,7 @@ dirroot .'/blog/lib.php'); +require_once($CFG->dirroot .'/course/lib.php'); class block_blog_menu extends block_base { @@ -11,7 +12,7 @@ class block_blog_menu extends block_base { } function get_content() { - global $CFG, $USER; + global $CFG, $USER, $COURSE, $DB, $PAGE; if (empty($CFG->bloglevel)) { $this->content->text = ''; @@ -40,77 +41,249 @@ class block_blog_menu extends block_base { $this->content = new stdClass; $this->content->footer = ''; - //if ( blog_isLoggedIn() && !isguest() ) { - $courseviewlink = ''; + if (empty($this->instance)) { + // Either we're being asked for content without + // an associated instance of the Blog module has never been installed. + $this->content->text = $output; + return $this->content; + } + //discover context for pre-loaded associations + $basefilters = array(); + if(!empty($COURSE)) $courseid = $COURSE->id; + switch($PAGE->pagetype) { + case PAGE_COURSE_VIEW: + $courseid = $PAGE->courserecord->id; + $basefilters['courseid'] = $courseid; + break; + case PAGE_BLOG_VIEW: + $basefilters = $PAGE->filters; + if(!empty($PAGE->filters['course'])) + $courseid = $PAGE->filters['course']; + if(!empty($PAGE->filters['mod'])) + $modid = $PAGE->filters['mod']; + if(!empty($PAGE->filters['user'])) + $userid = $PAGE->filters['user']; + if(!empty($PAGE->filters['group'])) + $groupid = $PAGE->filters['group']; + if(!empty($PAGE->filters['tag'])) + $tagid = $PAGE->filters['tag']; + break; + } + $addentrylink = ''; - $coursearg = ''; + $blogprefslink = ''; + $myviewlink = ''; + $siteviewlink = ''; + $courseviewlink = ''; + $modviewlink = ''; + $groupviewlink = ''; + $userviewlink = ''; + $tagviewlink = ''; + $coursepopuplink = ''; + $modpopuplink = ''; + $grouppopuplink = ''; + $userspopuplink = ''; + //create basic blog preference links + $coursearg = ''; $sitecontext = get_context_instance(CONTEXT_SYSTEM); if ($this->page->course->id != SITEID) { - $incoursecontext = true; $curcontext = get_context_instance(CONTEXT_COURSE, $this->page->course->id); } else { $incoursecontext = false; $curcontext = $sitecontext; } - $canviewblogs = has_capability('moodle/blog:view', $curcontext); - - /// Accessibility: markup as a list. - if ( (isloggedin() && !isguest()) && $incoursecontext - && $CFG->bloglevel >= BLOG_COURSE_LEVEL && $canviewblogs) { + && $CFG->bloglevel >= BLOG_SITE_LEVEL && $canviewblogs) { $coursearg = '&courseid='.$this->page->course->id; + if(!empty($modid)) $coursearg .= '&modid='.$modid; + // a course is specified $courseviewlink = '
  • '; $courseviewlink .= get_string('viewcourseentries', 'blog') ."
  • \n"; } - $blogmodon = false; - if ( (isloggedin() && !isguest()) && (!$blogmodon || ($blogmodon && $coursearg != '')) && $CFG->bloglevel >= BLOG_USER_LEVEL ) { - - // show Add entry link + // create the Add entry link if (has_capability('moodle/blog:create', $sitecontext)) { $addentrylink = '
  • '.get_string('addnewentry', 'blog') ."
  • \n"; } - // show View my entries link - $addentrylink .= '
  • '.get_string('viewmyentries', 'blog'). - "
  • \n"; - - // show link to manage blog prefs - $addentrylink .= '
  • wwwroot. '/blog/preferences.php?userid='. $userBlog->userid . $coursearg .'">'. get_string('blogpreferences', 'blog')."
  • \n"; - - $output = $addentrylink; - $output .= $courseviewlink; + // create the View my entries link + $myviewlink = '
  • '. + //''.fullname($USER). + get_string('viewmyentries', 'blog'). + "
  • \n"; } - // show View site entries link + // create the View site entries link if ($CFG->bloglevel >= BLOG_SITE_LEVEL && $canviewblogs) { - $output .= '
  • '; - $output .= get_string('viewsiteentries', 'blog')."
  • \n"; + $siteviewlink .= '
  • '. + get_string('viewsiteentries', 'blog'). + //$DB->get_field('course', 'shortname', array('format'=>'site')). + "
  • \n"; + } + + //create 'view blogs for course' link + if($incoursecontext and (!empty($modid) or !empty($userid) or !empty($tagid) or !empty($groupid) or + $PAGE->pagetype == PAGE_COURSE_VIEW) + and $CFG->bloglevel >= BLOG_SITE_LEVEL and $canviewblogs) { + $courseviewlink = '
  • ' + .''. + $DB->get_field('course', 'shortname', array('id'=>$courseid)) ."
  • \n"; + } + + //create 'view blogs for user' link + if(!empty($userid) and $userid != $USER->id and (!empty($modid) or !empty($courseid) or !empty($tagid) or !empty($groupid)) + and $canviewblogs) { + $userviewlink = '
  • '. + ''. + $DB->get_field('user', 'username', array('id'=>$userid)). + "
  • \n"; } - // took out tag management interface/link, should use tag/manage.php + //create 'view blogs for mod' link + if(!empty($modid) and (!empty($groupid) or !empty($userid) or !empty($tagid)) + and $CFG->bloglevel >= BLOG_SITE_LEVEL and $canviewblogs) { + $filtercontext = get_context_instance(CONTEXT_MODULE, $modid); + $modinfo = $DB->get_record('course_modules', array('id' => $filtercontext->instanceid)); + $modname = $DB->get_field('modules', 'name', array('id' => $modinfo->module)); + $modviewlink = '
  • '. + ''. + $DB->get_field($modname, 'name', array('id' => $modinfo->instance)). + "
  • \n"; + } + + //create 'view blogs for group' link + if(!empty($groupid) and (!empty($modid) or !empty($tagid) or !empty($userid)) + and $CFG->bloglevel >= BLOG_SITE_LEVEL and $canviewblogs) { + $groupviewlink = '
  • '. + ''. + $DB->get_field('groups', 'name', array('id'=>$groupid)) ."
  • \n"; + } + + //create 'view blogs for tag' link + if(!empty($tagid) && (!empty($modid) or !empty($userid) or !empty($courseid) or !empty($groupid)) and $canviewblogs) { + $tagviewlink = '
  • '.get_string('tag', 'tag').': '. + $DB->get_field('tag', 'name', array('id'=>$tagid))."
  • \n"; + } - // show Help with blogging link - //$output .= '
  • '; - //$output .= get_string('helpblogging', 'blog') ."
  • \n"; - //} else { - // $output = ''; //guest users and users who are not logged in do not get menus - //} + //create 'view blogs for this site's courses' link + if($canviewblogs and $CFG->bloglevel >= BLOG_SITE_LEVEL) { + $courseoptions = array(); + if(!empty($courseid)) { + if($courseid != SITEID) { + $newfilters = $basefilters; + unset($newfilters['course']); + unset($newfilters['mod']); + unset($newfilters['group']); + $courseoptions = array(blog_get_blogs_url($newfilters) => 'none'); + } + } + + foreach($DB->get_records('course', array()) as $course) { + if($course->id != SITEID) { + $newfilters = $basefilters; + if(!empty($courseid)) { + if($course->id != $courseid) { + unset($newfilters['mod']); + } + } + $newfilters['course'] = $course->id; + $courseoptions[blog_get_blogs_url($newfilters)] = $course->shortname; + } + } + $coursepopuplink = '
  • '.popup_form('', $courseoptions, 'view_course_blogs', blog_get_blogs_url($basefilters), + get_string('course'),'', '', true) . "
  • \n"; + } + + //create 'view blogs for this course's mods' link + if(!empty($courseid) and $canviewblogs and $CFG->bloglevel >= BLOG_SITE_LEVEL) { + $modnames = array(); + $modnamesplural = array(); + $modnamesused = array(); + $modoptions = array(); + if(!empty($modid)) { + $newfilters = $basefilters; + unset($newfilters['mod']); + $modoptions = array(blog_get_blogs_url($newfilters) => 'none'); + } + get_all_mods($courseid, $mods, $modnames, $modnamesplural, $modnamesused); + foreach($mods as $i => $mod) { + $newfilters = $basefilters; + $newfilters['mod'] = $mod->id; + $modoptions[blog_get_blogs_url($newfilters)] = $DB->get_field($mod->modname, 'name', array('id' => $mod->instance)); + } + $modpopuplink = '
  • '.popup_form('', $modoptions, 'view_mod_blogs', blog_get_blogs_url($basefilters), + get_string('resource').'/'.get_string('activity'), + '', '', true)."
  • \n"; + } + + //create 'view blogs for this course's groups link + if($incoursecontext and $canviewblogs and $CFG->bloglevel >= BLOG_SITE_LEVEL) { + $groupoptions = array(); + if(!empty($groupid)) { + $newfilters = $basefilters; + unset($newfilters['group']); + $groupoptions = array(blog_get_blogs_url($newfilters) => 'none'); + } + + foreach($DB->get_records('groups', array('courseid'=>$courseid)) as $group) { + $newfilters = $basefilters; + $newfilters['group'] = $group->id; + $groupoptions[blog_get_blogs_url($newfilters)] = $group->name; + } + $grouppopuplink = '
  • '.popup_form('', $groupoptions, 'view_group_blogs', blog_get_blogs_url($basefilters), + get_string('group'),'', '', true)."
  • \n"; + } + + //create 'view blogs for this course/group's users link + if(!empty($courseid) and $canviewblogs and $CFG->bloglevel >= BLOG_SITE_LEVEL) { + $useroptions = array(); + if(!empty($userid)) { + $newfilters = $basefilters; + unset($newfilters['user']); + $useroptions = array(blog_get_blogs_url($newfilters) => 'none'); + } + if(!empty($groupid)) { + $members = $DB->get_records('groups_members', array('groupid'=>$groupid)); + } else { + $coursecontext = get_context_instance(CONTEXT_COURSE, $courseid); + $members = $DB->get_records('role_assignments', array('contextid'=>$coursecontext->id)); + } + foreach($members as $member) { + $newfilters = $basefilters; + $newfilters['user'] = $member->userid; + $useroptions[blog_get_blogs_url($newfilters)] = $DB->get_field('user', 'username', array('id'=>$member->userid)); + } + $userspopuplink = '
  • '.popup_form('', $useroptions, 'view_user_blogs', blog_get_blogs_url($basefilters), + get_string('user'),'', '', true)."
  • \n"; + + } + + + $this->content->text = '\n"; - $this->content->text = '\n"; return $this->content; } } diff --git a/blocks/blog_tags/block_blog_tags.php b/blocks/blog_tags/block_blog_tags.php index 77e42b891d..3a1286e9f2 100644 --- a/blocks/blog_tags/block_blog_tags.php +++ b/blocks/blog_tags/block_blog_tags.php @@ -128,16 +128,6 @@ class block_blog_tags extends block_base { $filterselect = $USER->id; break; - case BLOG_GROUP_LEVEL: - $filtertype = 'group'; - $filterselect = groups_get_course_group($this->page->course); - break; - - case BLOG_COURSE_LEVEL: - $filtertype = 'course'; - $filterselect = $this->page->course->id; - break; - default: if ($this->page->course->id != SITEID) { $filtertype = 'course'; @@ -149,7 +139,7 @@ class block_blog_tags extends block_base { break; } - $link = $CFG->wwwroot.'/blog/index.php?filtertype='.$filtertype.'&filterselect='.$filterselect.'&tagid='.$tag->id; + $link = blog_get_blogs_url(array($filtertype => $filterselect, 'tag'=>$tag->id)); $this->content->text .= '
  • '. diff --git a/blog/index.php b/blog/index.php index a9f8b3a81c..4d9a47d02d 100755 --- a/blog/index.php +++ b/blog/index.php @@ -8,6 +8,7 @@ require_once('../config.php'); require_once($CFG->dirroot .'/blog/lib.php'); +require_once($CFG->dirroot .'/blog/newlib.php'); $id = optional_param('id', 0, PARAM_INT); $start = optional_param('formstart', 0, PARAM_INT); @@ -15,12 +16,28 @@ $userid = optional_param('userid', 0, PARAM_INT); $tag = optional_param('tag', '', PARAM_NOTAGS); $tagid = optional_param('tagid', 0, PARAM_INT); $postid = optional_param('postid', 0, PARAM_INT); -$filtertype = optional_param('filtertype', '', PARAM_ALPHA); -$filterselect = optional_param('filterselect', 0, PARAM_INT); - +$listing_type = optional_param('listing_type', '', PARAM_ALPHA); +$listing_id = optional_param('listing_id', null, PARAM_INT); $edit = optional_param('edit', -1, PARAM_BOOL); $courseid = optional_param('courseid', 0, PARAM_INT); // needed for user tabs and course tracking +//correct tagid if a text tag is provided as a param +if (!empty($tag)) { //text tag parameter takes precedence + if ($tagrec = $DB->get_record_sql("SELECT * FROM {tag} WHERE name LIKE ?", array($tag))) { + $tagid = $tagrec->id; + } else { + unset($tagid); + } +} + +//add courseid if modid or groupid is specified +if (!empty($modid) and empty($courseid)) { + $courseid = $DB->get_field('course_modules', 'course', array('id'=>$modid)); +} + +if (!empty($groupid) and empty($courseid)) { + $courseid = $DB->get_field('groups', 'courseid', array('id'=>$groupid)); +} if (empty($CFG->bloglevel)) { print_error('blogdisable', 'blog'); @@ -33,132 +50,154 @@ if (isloggedin() and !isguest() and $edit != -1) { $USER->editing = $edit; } -if (empty($filtertype)) { - if ($userid) { // default to user if specified - $filtertype = 'user'; - $filterselect = $userid; - } else if (has_capability('moodle/blog:view', $sitecontext) and $CFG->bloglevel > BLOG_USER_LEVEL) { - if ($postid) { - $filtertype = 'user'; - if (!$postobject = $DB->get_record('post', array('module'=>'blog', 'id'=>$postid))) { - print_error('nosuchentry', 'blog'); - } - $filterselect = $postobject->userid; - } else { - $filtertype = 'site'; - $filterselect = ''; +if (!$userid and has_capability('moodle/blog:view', $sitecontext) and $CFG->bloglevel > BLOG_USER_LEVEL) { + if ($postid) { + if (!$postobject = $DB->get_record('post', array('module'=>'blog', 'id'=>$postid))) { + print_error('nosuchentry', 'blog'); } - } else { - // user might have capability to write blogs, but not read blogs at site level - // users might enter this url manually without parameters - $filtertype = 'user'; - $filterselect = $USER->id; + $userid = $postobject->userid; } +} else if (!$userid) { + // user might have capability to write blogs, but not read blogs at site level + // users might enter this url manually without parameters + $userid = $USER->id; } /// check access and prepare filters -switch ($filtertype) { +if (!empty($modid)) { //check mod access + if ($CFG->bloglevel < BLOG_SITE_LEVEL) { + print_error(get_string('nocourseblogs', 'blog')); + } + if (!$mod = $DB->get_record('course_modules', array('id' => $modid))) { + print_error(get_string('invalidmodid', 'blog')); + } + $courseid = $mod->course; +} - case 'site': - if ($CFG->bloglevel < BLOG_SITE_LEVEL) { - print_error('siteblogdisable', 'blog'); - } - if ($CFG->bloglevel < BLOG_GLOBAL_LEVEL) { - require_login(); - } - if (!has_capability('moodle/blog:view', $sitecontext)) { - print_error('cannotviewsiteblog', 'blog'); - } - break; +if ((empty($courseid) ? true : $courseid == SITEID) and empty($userid)) { //check site access + if ($CFG->bloglevel < BLOG_SITE_LEVEL) { + print_error('siteblogdisable', 'blog'); + } + if ($CFG->bloglevel < BLOG_GLOBAL_LEVEL) { + require_login(); + } + if (!has_capability('moodle/blog:view', $sitecontext)) { + print_error('cannotviewsiteblog', 'blog'); + } - case 'course': - if ($CFG->bloglevel < BLOG_COURSE_LEVEL) { - print_error('courseblogdisable', 'blog'); - } - if (!$course = $DB->get_record('course', array('id'=>$filterselect))) { - print_error('invalidcourseid'); - } - $courseid = $course->id; - $coursecontext = get_context_instance(CONTEXT_COURSE, $course->id); - require_login($course); - if (!has_capability('moodle/blog:view', $coursecontext)) { - print_error('cannotviewcourseblog', 'blog'); - } - break; + $COURSE = $DB->get_record('course', array('format'=>'site')); + $courseid = $COURSE->id; +} + +if (!empty($courseid)) { + if (!$course = $DB->get_record('course', array('id'=>$courseid))) { + print_error('invalidcourseid'); + } + + $courseid = $course->id; + $coursecontext = get_context_instance(CONTEXT_COURSE, $course->id); + + require_login($course); + + if (!has_capability('moodle/blog:view', $coursecontext)) { + print_error('cannotviewcourseblog', 'blog'); + } +} else { + $coursecontext = get_context_instance(CONTEXT_COURSE, SITEID); +} + +if (!empty($groupid)) { + if ($CFG->bloglevel < BLOG_SITE_LEVEL) { + print_error('groupblogdisable', 'blog'); + } - case 'group': - if ($CFG->bloglevel < BLOG_GROUP_LEVEL) { - print_error('groupblogdisable', 'blog'); - } - // fix for MDL-9268 - if (! $group = groups_get_group($filterselect)) { //TODO:check. - print_error('invalidgroupid'); - } - if (!$course = $DB->get_record('course', array('id'=>$group->courseid))) { - print_error('invalidcourseid'); - } - $coursecontext = get_context_instance(CONTEXT_COURSE, $course->id); - $courseid = $course->id; - require_login($course); - if (!has_capability('moodle/blog:view', $coursecontext)) { - print_error('cannotviewcourseorgroupblog', 'blog'); - } - if (groups_get_course_groupmode($course) == SEPARATEGROUPS - and !has_capability('moodle/site:accessallgroups', $coursecontext)) { - if (!groups_is_member($filterselect)) { - print_error('notmemberofgroup'); - } - } + if (! $group = groups_get_group($groupid)) { //TODO:check. + print_error(get_string('invalidgroupid', 'blog')); + } - break; + if (!$course = $DB->get_record('course', array('id'=>$group->courseid))) { + print_error(get_string('invalidcourseid', 'blog')); + } - case 'user': - if ($CFG->bloglevel < BLOG_USER_LEVEL) { - print_error('blogdisable', 'blog'); - } - if (!$user = $DB->get_record('user', array('id'=>$filterselect))) { - print_error('invaliduserid'); - } - if ($user->deleted) { - print_header(); - print_heading(get_string('userdeleted')); - print_footer(); - die; - } + $coursecontext = get_context_instance(CONTEXT_COURSE, $course->id); + $courseid = $course->id; + require_login($course); + + if (!has_capability('moodle/blog:view', $coursecontext)) { + print_error(get_string('cannotviewcourseorgroupblog', 'blog')); + } - if ($USER->id == $filterselect) { - if (!has_capability('moodle/blog:create', $sitecontext) - and !has_capability('moodle/blog:view', $sitecontext)) { - print_error('donothaveblog', 'blog'); - } - } else { - $personalcontext = get_context_instance(CONTEXT_USER, $filterselect); - if (!has_capability('moodle/blog:view', $sitecontext) - and !has_capability('moodle/user:readuserblogs', $personalcontext)) { - print_error('cannotviewuserblog', 'blog'); - } - if (!blog_user_can_view_user_post($filterselect)) { - print_error('cannotviewcourseblog', 'blog'); - } + if (groups_get_course_groupmode($course) == SEPARATEGROUPS and !has_capability('moodle/site:accessallgroups', $coursecontext)) { + if (!groups_is_member($groupid)) { + print_error('notmemberofgroup'); } - $userid = $filterselect; + } +} + +if (!empty($user)) { + if ($CFG->bloglevel < BLOG_USER_LEVEL) { + print_error('blogdisable', 'blog'); + } + + if (!$user = $DB->get_record('user', array('id'=>$userid))) { + print_error('invaliduserid'); + } + + if ($user->deleted) { + print_header(); + print_heading(get_string('userdeleted')); + print_footer(); + die; + } - if (!empty($courseid)) { - require_login($courseid); + if ($USER->id == $userid) { + if (!has_capability('moodle/blog:create', $sitecontext) + and !has_capability('moodle/blog:view', $sitecontext)) { + print_error('donothaveblog', 'blog'); } + } else { + $personalcontext = get_context_instance(CONTEXT_USER, $userid); - break; + if (!has_capability('moodle/blog:view', $sitecontext) and !has_capability('moodle/user:readuserblogs', $personalcontext)) { + print_error('cannotviewuserblog', 'blog'); + } - default: - print_error('incorrectblogfilter', 'blog'); - break; + if (!blog_user_can_view_user_post($userid)) { + print_error('cannotviewcourseblog', 'blog'); + } + } } if (empty($courseid)) { $courseid = SITEID; } +if(!empty($postid)) { + $filters['post'] = $postid; +} + +if(!empty($courseid)) { + $filters['course'] = $courseid; +} + +if(!empty($modid)) { + $filters['mod'] = $modid; +} + +if(!empty($groupid)) { + $filters['group'] = $groupid; +} + +if(!empty($userid)) { + $filters['user'] = $userid; +} + +if(!empty($tagid)) { + $filters['tag'] = $tagid; +} + +$PAGE->title = get_string('blog'); include($CFG->dirroot .'/blog/header.php'); blog_print_html_formatted_entries($postid, $filtertype, $filterselect, $tagid, $tag); @@ -167,5 +206,6 @@ add_to_log($courseid, 'blog', 'view', 'index.php?filtertype='.$filtertype.'& include($CFG->dirroot .'/blog/footer.php'); +print_footer(); ?> diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index 13f7b90dae..c6434f33a1 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -593,6 +593,40 @@ function xmldb_main_upgrade($oldversion) { $dbman->change_field_type($table, $field); upgrade_main_savepoint($result, 2008081500); } + if ($result && $oldversion < 2008081300) { + /// Define table blog_association to be created + $table = new xmldb_table('blog_association'); + + /// Adding fields to table blog_association + $table->add_field('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null); + $table->add_field('contextid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, null); + $table->add_field('blogid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, null); + /// Adding keys to table blog_association + $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id')); + $table->add_key('contextid', XMLDB_KEY_FOREIGN, array('contextid'), 'context', array('id')); + $table->add_key('blogid', XMLDB_KEY_FOREIGN, array('blogid'), 'post', array('id')); + + if (!$dbman->table_exists($table)) { + /// Launch create table for blog_association + $dbman->create_table($table); + } + + + /// Main savepoint reached + upgrade_main_savepoint($result, 2008081300); + } + if ($result && $oldversion < 2008081301) { + + /// Changing list of values (enum) of field publishstate on table post to 'draft', 'site', 'public', 'group', 'course' + $table = new xmldb_table('post'); + $field = new xmldb_field('publishstate', XMLDB_TYPE_CHAR, '20', null, XMLDB_NOTNULL, null, XMLDB_ENUM, array('draft', 'site', 'public', 'group', 'course'), 'draft', 'attachment'); + + /// Launch change of list of values for field publishstate + $dbman->change_field_enum($table, $field); + + /// Main savepoint reached + upgrade_main_savepoint($result, 2008081301); + } if ($result && $oldversion < 2008081501) { $table = new xmldb_table('question'); @@ -2265,6 +2299,15 @@ WHERE gradeitemid IS NOT NULL AND grademax IS NOT NULL"); } upgrade_main_savepoint($result, 2009063000); } + + if ($result && $oldversion < 2009070100) { + // MDL-19677 Change $CFG->bloglevel to BLOG_SITE_LEVEL if BLOG_COURSE_LEVEL or BLOG_GROUP_LEVEL + $current_bloglevel = get_config(null, 'bloglevel'); + + if ($current_bloglevel == BLOG_GROUP_LEVEL || $current_bloglevel == BLOG_COURSE_LEVEL) { + set_config('bloglevel', BLOG_SITE_LEVEL); + } + } return $result; } -- 2.39.5