Dropping forum.open and forum.assesspublic from .sql files. Added forum
upgrade to roles code to postgres7.php.
This commit is contained in:
@@ -8,9 +8,7 @@ CREATE TABLE prefix_forum (
|
||||
type enum('single','news','general','social','eachuser','teacher','qanda') NOT NULL default 'general',
|
||||
name varchar(255) NOT NULL default '',
|
||||
intro text NOT NULL default '',
|
||||
open tinyint(2) unsigned NOT NULL default '2',
|
||||
assessed int(10) unsigned NOT NULL default '0',
|
||||
assesspublic int(4) unsigned NOT NULL default '0',
|
||||
assesstimestart int(10) unsigned NOT NULL default '0',
|
||||
assesstimefinish int(10) unsigned NOT NULL default '0',
|
||||
scale int(10) NOT NULL default '0',
|
||||
|
||||
@@ -218,6 +218,46 @@ function forum_upgrade($oldversion) {
|
||||
} // End if.
|
||||
}
|
||||
|
||||
|
||||
if ($oldversion < 2006081800) {
|
||||
// Upgrades for new roles and capabilities support.
|
||||
require_once($CFG->dirroot.'/mod/forum/lib.php');
|
||||
|
||||
$forummod = get_record('modules', 'name', 'forum');
|
||||
|
||||
if ($forums = get_records('forum')) {
|
||||
|
||||
if (!$studentroles = get_roles_with_capability('moodle/legacy:student', CAP_ALLOW)) {
|
||||
notice('Default student role was not found. Roles and permissions '.
|
||||
'for all your forums will have to be manually set after '.
|
||||
'this upgrade.');
|
||||
}
|
||||
if (!$guestroles = get_roles_with_capability('moodle/legacy:guest', CAP_ALLOW)) {
|
||||
notice('Default guest role was not found. Roles and permissions '.
|
||||
'for teacher forums will have to be manually set after '.
|
||||
'this upgrade.');
|
||||
}
|
||||
|
||||
foreach ($forums as $forum) {
|
||||
if (!forum_convert_to_roles($forum, $forummod->id,
|
||||
$studentroles, $guestroles)) {
|
||||
notice('Forum with id '.$forum->id.' was not upgraded');
|
||||
}
|
||||
}
|
||||
|
||||
// Drop column forum.open.
|
||||
modify_database('', 'ALTER TABLE prefix_forum DROP COLUMN open;');
|
||||
|
||||
// Drop column forum.assesspublic.
|
||||
modify_database('', 'ALTER TABLE prefix_forum DROP COLUMN assesspublic;');
|
||||
|
||||
// We need to rebuild all the course caches to refresh the state of
|
||||
// the forum modules.
|
||||
rebuild_course_cache();
|
||||
|
||||
} // End if.
|
||||
}
|
||||
|
||||
if ($oldversion < 2006082700) {
|
||||
$sql = "UPDATE {$CFG->prefix}forum_posts SET message = REPLACE(message, '".TRUSTTEXT."', '');";
|
||||
$likecond = sql_ilike()." '%".TRUSTTEXT."%'";
|
||||
|
||||
@@ -8,9 +8,7 @@ CREATE TABLE prefix_forum (
|
||||
type varchar(10) CHECK (type IN ('single','news','general','social','eachuser','teacher','qanda')) NOT NULL default 'general',
|
||||
name varchar(255) NOT NULL default '',
|
||||
intro text NOT NULL default '',
|
||||
open integer NOT NULL default '2',
|
||||
assessed integer NOT NULL default '0',
|
||||
assesspublic integer NOT NULL default '0',
|
||||
assesstimestart integer NOT NULL default '0',
|
||||
assesstimefinish integer NOT NULL default '0',
|
||||
scale integer NOT NULL default '0',
|
||||
|
||||
Reference in New Issue
Block a user