From 219f652b9102c4de4abe69ad0d166e2ab78033fe Mon Sep 17 00:00:00 2001 From: skodak Date: Sat, 31 May 2008 18:05:42 +0000 Subject: [PATCH] MDL-14679 upgrade $DB conversion --- backup/db/upgrade.php | 2 +- .../block_activity_modules.php | 4 +- blocks/activity_modules/db/upgrade.php | 2 +- blocks/admin/db/upgrade.php | 2 +- blocks/blog_tags/block_blog_tags.php | 23 +- blocks/calendar_month/db/upgrade.php | 2 +- blocks/calendar_upcoming/db/upgrade.php | 2 +- blocks/course_list/db/upgrade.php | 2 +- blocks/course_summary/db/upgrade.php | 2 +- blocks/db/upgrade.php | 6 +- blocks/news_items/db/upgrade.php | 2 +- blocks/online_users/db/upgrade.php | 2 +- blocks/participants/db/upgrade.php | 2 +- blocks/recent_activity/db/upgrade.php | 2 +- blocks/rss_client/db/upgrade.php | 4 +- blocks/search/db/upgrade.php | 2 +- blocks/search_forums/db/upgrade.php | 2 +- blocks/section_links/block_section_links.php | 8 +- blocks/section_links/db/upgrade.php | 2 +- .../site_main_menu/block_site_main_menu.php | 4 +- .../block_social_activities.php | 4 +- blocks/social_activities/db/upgrade.php | 2 +- enrol/paypal/db/upgrade.php | 2 +- files/index.php | 2 +- filter/activitynames/filter.php | 5 +- filter/algebra/algebradebug.php | 2 +- filter/algebra/filter.php | 13 +- filter/algebra/pix.php | 2 +- mod/chat/db/upgrade.php | 13 +- mod/choice/db/upgrade.php | 4 +- mod/forum/db/upgrade.php | 20 +- mod/glossary/db/upgrade.php | 38 +-- mod/label/db/upgrade.php | 4 +- mod/quiz/db/upgrade.php | 57 +--- mod/resource/db/upgrade.php | 33 +-- mod/scorm/db/upgrade.php | 270 +----------------- mod/survey/db/upgrade.php | 4 +- mod/wiki/db/upgrade.php | 4 +- question/type/calculated/db/upgrade.php | 2 +- question/type/essay/db/upgrade.php | 2 +- question/type/match/db/upgrade.php | 2 +- question/type/multianswer/db/upgrade.php | 2 +- question/type/randomsamatch/db/upgrade.php | 2 +- question/type/shortanswer/db/upgrade.php | 2 +- question/type/truefalse/db/upgrade.php | 2 +- 45 files changed, 94 insertions(+), 476 deletions(-) diff --git a/backup/db/upgrade.php b/backup/db/upgrade.php index e2a5211a04..bc1af02f28 100644 --- a/backup/db/upgrade.php +++ b/backup/db/upgrade.php @@ -19,7 +19,7 @@ function xmldb_backup_upgrade($oldversion=0) { - global $CFG, $THEME, $db; + global $CFG, $THEME, $DB; $result = true; diff --git a/blocks/activity_modules/block_activity_modules.php b/blocks/activity_modules/block_activity_modules.php index 14e9239d1b..01b3278c1c 100644 --- a/blocks/activity_modules/block_activity_modules.php +++ b/blocks/activity_modules/block_activity_modules.php @@ -7,7 +7,7 @@ class block_activity_modules extends block_list { } function get_content() { - global $CFG, $COURSE; + global $CFG, $COURSE, $DB; if($this->content !== NULL) { return $this->content; @@ -21,7 +21,7 @@ class block_activity_modules extends block_list { if ($COURSE->id == $this->instance->pageid) { $course = $COURSE; } else { - $course = get_record('course', 'id', $this->instance->pageid); + $course = get_record('course', array('id'=>$this->instance->pageid)); } require_once($CFG->dirroot.'/course/lib.php'); diff --git a/blocks/activity_modules/db/upgrade.php b/blocks/activity_modules/db/upgrade.php index 44acccb7d4..0a0623f9ba 100644 --- a/blocks/activity_modules/db/upgrade.php +++ b/blocks/activity_modules/db/upgrade.php @@ -19,7 +19,7 @@ function xmldb_block_activity_modules_upgrade($oldversion=0) { - global $CFG, $THEME, $db; + global $CFG, $THEME, $DB; $result = true; diff --git a/blocks/admin/db/upgrade.php b/blocks/admin/db/upgrade.php index f2e83e31c9..115f3ce6d0 100644 --- a/blocks/admin/db/upgrade.php +++ b/blocks/admin/db/upgrade.php @@ -19,7 +19,7 @@ function xmldb_block_admin_upgrade($oldversion=0) { - global $CFG, $THEME, $db; + global $CFG, $THEME, $DB; $result = true; diff --git a/blocks/blog_tags/block_blog_tags.php b/blocks/blog_tags/block_blog_tags.php index b7c6a44a92..9aa1e4a493 100644 --- a/blocks/blog_tags/block_blog_tags.php +++ b/blocks/blog_tags/block_blog_tags.php @@ -39,8 +39,7 @@ class block_blog_tags extends block_base { } function get_content() { - - global $CFG, $SITE, $COURSE, $USER; + global $CFG, $SITE, $COURSE, $USER, $DB; if (empty($CFG->usetags) || empty($CFG->bloglevel)) { $this->content->text = ''; @@ -74,20 +73,20 @@ class block_blog_tags extends block_base { $timewithin = time() - $this->config->timewithin * 24 * 60 * 60; /// convert to seconds - $sql = 'SELECT t.id, t.tagtype, t.rawname, t.name, COUNT(DISTINCT ti.id) AS ct '; - $sql .= "FROM {$CFG->prefix}tag t, {$CFG->prefix}tag_instance ti, {$CFG->prefix}post p "; - $sql .= 'WHERE t.id = ti.tagid '; - $sql .= 'AND p.id = ti.itemid '; - // admins should be able to read all tags if (!has_capability('moodle/user:readuserblogs', get_context_instance(CONTEXT_SYSTEM))) { - $sql .= 'AND (p.publishstate = \'site\' or p.publishstate=\'public\') '; + $type .= " AND (p.publishstate = 'site' or p.publishstate='public')"; } - $sql .= "AND ti.timemodified > {$timewithin} "; - $sql .= 'GROUP BY t.id, t.tagtype, t.name, t.rawname '; - $sql .= 'ORDER BY ct DESC, t.name ASC'; - if ($tags = get_records_sql($sql, 0, $this->config->numberoftags)) { + $sql = "SELECT t.id, t.tagtype, t.rawname, t.name, COUNT(DISTINCT ti.id) AS ct + FROM {tag} t, {tag_instance} ti, {post} p + WHERE t.id = ti.tagid AND p.id = ti.itemid + $type + AND ti.timemodified > $timewithin + GROUP BY t.id, t.tagtype, t.name, t.rawname + ORDER BY ct DESC, t.name ASC"; + + if ($tags = get_records_sql($sql, null, 0, $this->config->numberoftags)) { /// There are 2 things to do: /// 1. tags with the same count should have the same size class diff --git a/blocks/calendar_month/db/upgrade.php b/blocks/calendar_month/db/upgrade.php index d507b797e2..99ff41a448 100644 --- a/blocks/calendar_month/db/upgrade.php +++ b/blocks/calendar_month/db/upgrade.php @@ -19,7 +19,7 @@ function xmldb_block_calendar_month_upgrade($oldversion=0) { - global $CFG, $THEME, $db; + global $CFG, $THEME, $DB; $result = true; diff --git a/blocks/calendar_upcoming/db/upgrade.php b/blocks/calendar_upcoming/db/upgrade.php index db83a40dfb..2c4cefb2e9 100644 --- a/blocks/calendar_upcoming/db/upgrade.php +++ b/blocks/calendar_upcoming/db/upgrade.php @@ -19,7 +19,7 @@ function xmldb_block_calendar_upcoming_upgrade($oldversion=0) { - global $CFG, $THEME, $db; + global $CFG, $THEME, $DB; $result = true; diff --git a/blocks/course_list/db/upgrade.php b/blocks/course_list/db/upgrade.php index 1d5e4ba1db..b5c3bd8365 100644 --- a/blocks/course_list/db/upgrade.php +++ b/blocks/course_list/db/upgrade.php @@ -19,7 +19,7 @@ function xmldb_block_course_list_upgrade($oldversion=0) { - global $CFG, $THEME, $db; + global $CFG, $THEME, $DB; $result = true; diff --git a/blocks/course_summary/db/upgrade.php b/blocks/course_summary/db/upgrade.php index a1023ef1c0..633555bbab 100644 --- a/blocks/course_summary/db/upgrade.php +++ b/blocks/course_summary/db/upgrade.php @@ -19,7 +19,7 @@ function xmldb_block_course_summary_upgrade($oldversion=0) { - global $CFG, $THEME, $db; + global $CFG, $THEME, $DB; $result = true; diff --git a/blocks/db/upgrade.php b/blocks/db/upgrade.php index 636f739868..66740a17d7 100644 --- a/blocks/db/upgrade.php +++ b/blocks/db/upgrade.php @@ -19,7 +19,9 @@ function xmldb_blocks_upgrade($oldversion=0) { - global $CFG, $THEME, $db; + global $CFG, $THEME, $DB; + + $dbman = $DB->get_manager(); $result = true; @@ -40,7 +42,7 @@ function xmldb_blocks_upgrade($oldversion=0) { $field->set_attributes(XMLDB_TYPE_TEXT, 'small', null, null, null, null, null, null, 'visible'); /// Launch change of nullability for field configdata - $result = $result && change_field_notnull($table, $field); + $result = $result && $dbman->change_field_notnull($table, $field); } diff --git a/blocks/news_items/db/upgrade.php b/blocks/news_items/db/upgrade.php index 976ebe617e..ee40a9d107 100644 --- a/blocks/news_items/db/upgrade.php +++ b/blocks/news_items/db/upgrade.php @@ -19,7 +19,7 @@ function xmldb_block_news_items_upgrade($oldversion=0) { - global $CFG, $THEME, $db; + global $CFG, $THEME, $DB; $result = true; diff --git a/blocks/online_users/db/upgrade.php b/blocks/online_users/db/upgrade.php index 014a59f8fb..31f3632c57 100644 --- a/blocks/online_users/db/upgrade.php +++ b/blocks/online_users/db/upgrade.php @@ -19,7 +19,7 @@ function xmldb_block_online_users_upgrade($oldversion=0) { - global $CFG, $THEME, $db; + global $CFG, $THEME, $DB; $result = true; diff --git a/blocks/participants/db/upgrade.php b/blocks/participants/db/upgrade.php index d4386b4852..faea7eb5ff 100644 --- a/blocks/participants/db/upgrade.php +++ b/blocks/participants/db/upgrade.php @@ -19,7 +19,7 @@ function xmldb_block_participants_upgrade($oldversion=0) { - global $CFG, $THEME, $db; + global $CFG, $THEME, $DB; $result = true; diff --git a/blocks/recent_activity/db/upgrade.php b/blocks/recent_activity/db/upgrade.php index 27b853d17b..36b534eb30 100644 --- a/blocks/recent_activity/db/upgrade.php +++ b/blocks/recent_activity/db/upgrade.php @@ -19,7 +19,7 @@ function xmldb_block_recent_activity_upgrade($oldversion=0) { - global $CFG, $THEME, $db; + global $CFG, $THEME, $DB; $result = true; diff --git a/blocks/rss_client/db/upgrade.php b/blocks/rss_client/db/upgrade.php index 5b4f47e0e4..90996fbc78 100644 --- a/blocks/rss_client/db/upgrade.php +++ b/blocks/rss_client/db/upgrade.php @@ -19,7 +19,7 @@ function xmldb_block_rss_client_upgrade($oldversion=0) { - global $CFG, $THEME, $db; + global $CFG, $THEME, $DB; $result = true; @@ -30,7 +30,7 @@ function xmldb_block_rss_client_upgrade($oldversion=0) { if ($result && $oldversion < 2007080100) { //New version in version.php /// block_rss_timeout config setting must be block_rss_client_timeout - set_field('config', 'name', 'block_rss_client_timeout', 'name', 'block_rss_timeout'); + $DB->set_field('config', 'name', 'block_rss_client_timeout', array('name'=>'block_rss_timeout')); } return $result; diff --git a/blocks/search/db/upgrade.php b/blocks/search/db/upgrade.php index ca78ec8321..ef8679042e 100644 --- a/blocks/search/db/upgrade.php +++ b/blocks/search/db/upgrade.php @@ -19,7 +19,7 @@ function xmldb_block_search_upgrade($oldversion=0) { - global $CFG, $THEME, $db; + global $CFG, $THEME, $DB; $result = true; diff --git a/blocks/search_forums/db/upgrade.php b/blocks/search_forums/db/upgrade.php index 1678568cf4..ec4a9b84c3 100644 --- a/blocks/search_forums/db/upgrade.php +++ b/blocks/search_forums/db/upgrade.php @@ -19,7 +19,7 @@ function xmldb_block_search_forums_upgrade($oldversion=0) { - global $CFG, $THEME, $db; + global $CFG, $THEME, $DB; $result = true; diff --git a/blocks/section_links/block_section_links.php b/blocks/section_links/block_section_links.php index 982c25a09f..76f51d6aee 100644 --- a/blocks/section_links/block_section_links.php +++ b/blocks/section_links/block_section_links.php @@ -8,8 +8,10 @@ class block_section_links extends block_base { } function instance_config($instance) { + global $DB; + parent::instance_config($instance); - $course = get_record('course', 'id', $this->instance->pageid); + $course = get_record('course', array('id'=>$this->instance->pageid)); if (isset($course->format)) { if ($course->format == 'topics') { $this->title = get_string('topics', 'block_section_links'); @@ -26,7 +28,7 @@ class block_section_links extends block_base { } function get_content() { - global $CFG, $USER, $COURSE; + global $CFG, $USER, $COURSE, $DB; $highlight = 0; @@ -45,7 +47,7 @@ class block_section_links extends block_base { if ($this->instance->pageid == $COURSE->id) { $course = $COURSE; } else { - $course = get_record('course', 'id', $this->instance->pageid); + $course = get_record('course', array('id'=>$this->instance->pageid)); } $context = get_context_instance(CONTEXT_COURSE, $course->id); diff --git a/blocks/section_links/db/upgrade.php b/blocks/section_links/db/upgrade.php index d0409d4fb0..67b3b1bbbd 100644 --- a/blocks/section_links/db/upgrade.php +++ b/blocks/section_links/db/upgrade.php @@ -19,7 +19,7 @@ function xmldb_block_section_links_upgrade($oldversion=0) { - global $CFG, $THEME, $db; + global $CFG, $THEME, $DB; $result = true; diff --git a/blocks/site_main_menu/block_site_main_menu.php b/blocks/site_main_menu/block_site_main_menu.php index b46be89ed0..4940ec6129 100644 --- a/blocks/site_main_menu/block_site_main_menu.php +++ b/blocks/site_main_menu/block_site_main_menu.php @@ -11,7 +11,7 @@ class block_site_main_menu extends block_list { } function get_content() { - global $USER, $CFG, $COURSE; + global $USER, $CFG, $COURSE, $DB; if ($this->content !== NULL) { return $this->content; @@ -29,7 +29,7 @@ class block_site_main_menu extends block_list { if ($COURSE->id == $this->instance->pageid) { $course = $COURSE; } else { - $course = get_record('course', 'id', $this->instance->pageid); + $course = get_record('course', array('id'=>$this->instance->pageid)); } require_once($CFG->dirroot.'/course/lib.php'); diff --git a/blocks/social_activities/block_social_activities.php b/blocks/social_activities/block_social_activities.php index f425a22a4a..2dd7f8c0ce 100644 --- a/blocks/social_activities/block_social_activities.php +++ b/blocks/social_activities/block_social_activities.php @@ -11,7 +11,7 @@ class block_social_activities extends block_list { } function get_content() { - global $USER, $CFG, $COURSE; + global $USER, $CFG, $COURSE, $DB; if ($this->content !== NULL) { return $this->content; @@ -29,7 +29,7 @@ class block_social_activities extends block_list { if ($COURSE->id == $this->instance->pageid) { $course = $COURSE; } else { - $course = get_record('course', 'id', $this->instance->pageid); + $course = get_record('course', array('id'=>$this->instance->pageid)); } require_once($CFG->dirroot.'/course/lib.php'); diff --git a/blocks/social_activities/db/upgrade.php b/blocks/social_activities/db/upgrade.php index 6f4ea3d113..491f241849 100644 --- a/blocks/social_activities/db/upgrade.php +++ b/blocks/social_activities/db/upgrade.php @@ -19,7 +19,7 @@ function xmldb_block_social_activities_upgrade($oldversion=0) { - global $CFG, $THEME, $db; + global $CFG, $THEME, $DB; $result = true; diff --git a/enrol/paypal/db/upgrade.php b/enrol/paypal/db/upgrade.php index 347a30e8ca..2fd5c4308a 100644 --- a/enrol/paypal/db/upgrade.php +++ b/enrol/paypal/db/upgrade.php @@ -19,7 +19,7 @@ function xmldb_enrol_paypal_upgrade($oldversion=0) { - global $CFG, $THEME, $db; + global $CFG, $THEME, $DB; $result = true; diff --git a/files/index.php b/files/index.php index 1bc70c37c4..27513ffc42 100644 --- a/files/index.php +++ b/files/index.php @@ -30,7 +30,7 @@ } - if (! $course = get_record("course", "id", $id) ) { + if (! $course = $DB->get_record("course", array("id"=>$id))) { print_error('invalidcourseid'); } diff --git a/filter/activitynames/filter.php b/filter/activitynames/filter.php index 22c4ac149d..9c2f866f36 100644 --- a/filter/activitynames/filter.php +++ b/filter/activitynames/filter.php @@ -5,8 +5,7 @@ //Modifications by stronk7. function activitynames_filter($courseid, $text) { - - global $CFG, $COURSE; + global $CFG, $COURSE, $DB; // Trivial-cache - keyed on $cachedcourseid static $activitylist = null; @@ -30,7 +29,7 @@ if ($COURSE->id == $courseid) { $course = $COURSE; } else { - $course = get_record("course", "id", $courseid); + $course = $DB->get_record("course", array("id"=>$courseid)); } if (!isset($course->modinfo)) { diff --git a/filter/algebra/algebradebug.php b/filter/algebra/algebradebug.php index 96a919ef45..8ae16f6a6a 100644 --- a/filter/algebra/algebradebug.php +++ b/filter/algebra/algebradebug.php @@ -28,7 +28,7 @@ $algebra = substr($query,8,$splitpos); $md5 = md5($algebra); if (strpos($query,'ShowDB') || strpos($query,'DeleteDB')) { - $texcache = get_record("cache_filters","filter","algebra", "md5key", $md5); + $texcache = $DB->get_record("cache_filters", array("filter"=>"algebra", "md5key"=>$md5)); } if (strpos($query,'ShowDB')) { if ($texcache) { diff --git a/filter/algebra/filter.php b/filter/algebra/filter.php index bdd6d1d167..d0121e45df 100644 --- a/filter/algebra/filter.php +++ b/filter/algebra/filter.php @@ -86,8 +86,7 @@ function string_file_picture_algebra($imagefile, $tex= "", $height="", $width="" function algebra_filter ($courseid, $text) { - - global $CFG; + global $CFG, $DB; /// Do a quick check using stripos to avoid unnecessary wor if (!preg_match('/discussion); +# $discussion = $DB->get_record("forum_discussions",array("id"=>$parent->discussion)); # } else if (strstr($scriptname,'discuss.php')) { -# $discussion = get_record("forum_discussions","id",$_GET['d'] ); +# $discussion = $DB->get_record("forum_discussions", array("id"=>$_GET['d'])); # } else { # return $text; # } @@ -140,7 +139,7 @@ function algebra_filter ($courseid, $text) { } $md5 = md5($algebra); $filename = $md5 . ".gif"; - if (! $texcache = get_record("cache_filters","filter","algebra", "md5key", $md5)) { + if (! $texcache = $DB->get_record("cache_filters", array("filter"=>"algebra", "md5key"=>$md5))) { $algebra = str_replace('<','<',$algebra); $algebra = str_replace('>','>',$algebra); $algebra = str_replace('<>','#',$algebra); @@ -219,9 +218,9 @@ function algebra_filter ($courseid, $text) { $texcache->filter = 'algebra'; $texcache->version = 1; $texcache->md5key = $md5; - $texcache->rawtext = addslashes($texexp); + $texcache->rawtext = $texexp; $texcache->timemodified = time(); - insert_record("cache_filters",$texcache, false); + $DB->insert_record("cache_filters",$texcache, false); $text = str_replace( $matches[0][$i], string_file_picture_algebra($filename, $texexp, '', '', $align), $text); } else { $text = str_replace( $matches[0][$i],"Undetermined error: ",$text); diff --git a/filter/algebra/pix.php b/filter/algebra/pix.php index 80f849879e..3c14bd217f 100644 --- a/filter/algebra/pix.php +++ b/filter/algebra/pix.php @@ -40,7 +40,7 @@ if (!file_exists($pathname)) { $md5 = str_replace('.gif','',$image); - if ($texcache = get_record('cache_filters', 'filter', 'algebra', 'md5key', $md5)) { + if ($texcache = $DB->get_record('cache_filters', array('filter'=>'algebra', 'md5key'=>$md5))) { if (!file_exists($CFG->dataroot.'/filter/algebra')) { make_upload_directory('filter/algebra'); } diff --git a/mod/chat/db/upgrade.php b/mod/chat/db/upgrade.php index 55fe347678..cb7cebaff9 100644 --- a/mod/chat/db/upgrade.php +++ b/mod/chat/db/upgrade.php @@ -19,20 +19,11 @@ function xmldb_chat_upgrade($oldversion=0) { - global $CFG, $THEME, $db; + global $CFG, $THEME, $DB; $result = true; - if ($result && $oldversion < 2007012100) { - - /// Changing precision of field lang on table chat_users to (30) - $table = new XMLDBTable('chat_users'); - $field = new XMLDBField('lang'); - $field->setAttributes(XMLDB_TYPE_CHAR, '30', null, XMLDB_NOTNULL, null, null, null, null, 'course'); - - /// Launch change of precision for field lang - $result = $result && change_field_precision($table, $field); - } +//===== 1.9.0 upgrade line ======// return $result; } diff --git a/mod/choice/db/upgrade.php b/mod/choice/db/upgrade.php index 36a6c08953..5545b6d6de 100644 --- a/mod/choice/db/upgrade.php +++ b/mod/choice/db/upgrade.php @@ -19,7 +19,7 @@ function xmldb_choice_upgrade($oldversion=0) { - global $CFG, $THEME, $db; + global $CFG, $THEME, $DB; $result = true; @@ -32,6 +32,8 @@ function xmldb_choice_upgrade($oldversion=0) { /// $result = result of "/lib/ddllib.php" function calls /// } +//===== 1.9.0 upgrade line ======// + return $result; } diff --git a/mod/forum/db/upgrade.php b/mod/forum/db/upgrade.php index 9e774d625f..9e2eec5747 100644 --- a/mod/forum/db/upgrade.php +++ b/mod/forum/db/upgrade.php @@ -19,7 +19,7 @@ function xmldb_forum_upgrade($oldversion=0) { - global $CFG, $THEME, $db; + global $CFG, $THEME, $DB; $result = true; @@ -54,21 +54,21 @@ function xmldb_forum_upgrade($oldversion=0) { $roles = implode(',', $roles); $sql = "SELECT fs.userid, f.id AS forumid - FROM {$CFG->prefix}forum f - JOIN {$CFG->prefix}course c ON c.id = f.course - JOIN {$CFG->prefix}context ctx ON (ctx.instanceid = c.id AND ctx.contextlevel = ".CONTEXT_COURSE.") - JOIN {$CFG->prefix}forum_subscriptions fs ON fs.forum = f.id - LEFT JOIN {$CFG->prefix}role_assignments ra ON (ra.contextid = ctx.id AND ra.userid = fs.userid AND ra.roleid IN ($roles)) + FROM {forum} f + JOIN {course} c ON c.id = f.course + JOIN {context} ctx ON (ctx.instanceid = c.id AND ctx.contextlevel = ".CONTEXT_COURSE.") + JOIN {forum_subscriptions} fs ON fs.forum = f.id + LEFT JOIN {role_assignments} ra ON (ra.contextid = ctx.id AND ra.userid = fs.userid AND ra.roleid IN ($roles)) WHERE ra.id IS NULL"; - if ($rs = get_recordset_sql($sql)) { + if ($rs = $DB->get_recordset_sql($sql)) { $DB->set_debug(false); - while ($remove = rs_fetch_next_record($rs)) { - delete_records('forum_subscriptions', 'userid', $remove->userid, 'forum', $remove->forumid); + foreach ($rs as $remove) { + $DB->delete_records('forum_subscriptions', array('userid'=>$remove->userid, 'forum'=>$remove->forumid)); echo '.'; } $DB->set_debug(true); - rs_close($rs); + $rs-close(); } } diff --git a/mod/glossary/db/upgrade.php b/mod/glossary/db/upgrade.php index 5237f7bb96..4645ef457d 100644 --- a/mod/glossary/db/upgrade.php +++ b/mod/glossary/db/upgrade.php @@ -19,7 +19,7 @@ function xmldb_glossary_upgrade($oldversion=0) { - global $CFG, $THEME, $db; + global $CFG, $THEME, $DB; $result = true; @@ -32,42 +32,8 @@ function xmldb_glossary_upgrade($oldversion=0) { /// $result = result of "/lib/ddllib.php" function calls /// } - if ($result && $oldversion < 2006111400) { +//===== 1.9.0 upgrade line ======// - /// MDL-10475, set override for legacy:student before dropping studentcanpost - /// if the glossary disables student postings - - if ($glossaries = get_records('glossary', 'studentcanpost', '0')) { - foreach ($glossaries as $glossary) { - if ($cm = get_coursemodule_from_instance('glossary', $glossary->id)) { - // add student override in this instance - $context = get_context_instance(CONTEXT_MODULE, $cm->id); - // find all roles with legacy:student - if ($studentroles = get_roles_with_capability('moodle/legacy:student', CAP_ALLOW)) { - foreach ($studentroles as $studentrole) { - assign_capability('mod/glossary:write', CAP_PREVENT, $studentrole->id, $context->id); - } - } - } - } - } - - /// Define field studentcanpost to be dropped from glossary - $table = new XMLDBTable('glossary'); - $field = new XMLDBField('studentcanpost'); - - /// Launch drop field studentcanpost - $result = $result && drop_field($table, $field); - } - - if ($result && $oldversion < 2007072200) { - require_once($CFG->dirroot.'/mod/glossary/lib.php'); - // too much debug output - $db->debug = false; - glossary_update_grades(); - $db->debug = true; - } - return $result; } diff --git a/mod/label/db/upgrade.php b/mod/label/db/upgrade.php index ea656f1aff..c1046254e7 100644 --- a/mod/label/db/upgrade.php +++ b/mod/label/db/upgrade.php @@ -19,7 +19,7 @@ function xmldb_label_upgrade($oldversion=0) { - global $CFG, $THEME, $db; + global $CFG, $THEME, $DB; $result = true; @@ -32,6 +32,8 @@ function xmldb_label_upgrade($oldversion=0) { /// $result = result of "/lib/ddllib.php" function calls /// } +//===== 1.9.0 upgrade line ======// + return $result; } diff --git a/mod/quiz/db/upgrade.php b/mod/quiz/db/upgrade.php index 07b41df506..795e99fdbe 100644 --- a/mod/quiz/db/upgrade.php +++ b/mod/quiz/db/upgrade.php @@ -19,7 +19,7 @@ function xmldb_quiz_upgrade($oldversion=0) { - global $CFG, $THEME, $db; + global $CFG, $THEME, $DB; $result = true; @@ -28,60 +28,7 @@ function xmldb_quiz_upgrade($oldversion=0) { /// this comment lines once this file start handling proper /// upgrade code. - if ($result && $oldversion < 2007022800) { - /// Ensure that there are not existing duplicate entries in the database. - $duplicateunits = get_records_select('question_numerical_units', "id > (SELECT MIN(iqnu.id) - FROM {$CFG->prefix}question_numerical_units iqnu - WHERE iqnu.question = {$CFG->prefix}question_numerical_units.question AND - iqnu.unit = {$CFG->prefix}question_numerical_units.unit)", '', 'id'); - if ($duplicateunits) { - delete_records_select('question_numerical_units', 'id IN (' . implode(',', array_keys($duplicateunits)) . ')'); - } - - /// Define index question-unit (unique) to be added to question_numerical_units - $table = new XMLDBTable('question_numerical_units'); - $index = new XMLDBIndex('question-unit'); - $index->setAttributes(XMLDB_INDEX_UNIQUE, array('question', 'unit')); - - /// Launch add index question-unit - $result = $result && add_index($table, $index); - } - - if ($result && $oldversion < 2007070200) { - - /// Changing precision of field timelimit on table quiz to (10) - $table = new XMLDBTable('quiz'); - $field = new XMLDBField('timelimit'); - $field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'timemodified'); - - /// Launch change of precision for field timelimit - $result = $result && change_field_precision($table, $field); - } - - if ($result && $oldversion < 2007072200) { - require_once $CFG->dirroot.'/mod/quiz/lib.php'; - // too much debug output - $db->debug = false; - quiz_update_grades(); - $db->debug = true; - } - - // Separate control for when overall feedback is displayed, independant of the question feedback settings. - if ($result && $oldversion < 2007072600) { - - // Adjust the quiz review options so that overall feedback is displayed whenever feedback is. - $result = $result && execute_sql('UPDATE ' . $CFG->prefix . 'quiz SET review = ' . - sql_bitor(sql_bitand('review', sql_bitnot(QUIZ_REVIEW_OVERALLFEEDBACK)), - sql_bitor(sql_bitand('review', QUIZ_REVIEW_FEEDBACK & QUIZ_REVIEW_IMMEDIATELY) . ' * 65536', - sql_bitor(sql_bitand('review', QUIZ_REVIEW_FEEDBACK & QUIZ_REVIEW_OPEN) . ' * 16384', - sql_bitand('review', QUIZ_REVIEW_FEEDBACK & QUIZ_REVIEW_CLOSED) . ' * 4096')))); - - // Same adjustment to the defaults for new quizzes. - $result = $result && set_config('quiz_review', ($CFG->quiz_review & ~QUIZ_REVIEW_OVERALLFEEDBACK) | - (($CFG->quiz_review & QUIZ_REVIEW_FEEDBACK & QUIZ_REVIEW_IMMEDIATELY) << 16) | - (($CFG->quiz_review & QUIZ_REVIEW_FEEDBACK & QUIZ_REVIEW_OPEN) << 14) | - (($CFG->quiz_review & QUIZ_REVIEW_FEEDBACK & QUIZ_REVIEW_CLOSED) << 12)); - } +//===== 1.9.0 upgrade line ======// return $result; } diff --git a/mod/resource/db/upgrade.php b/mod/resource/db/upgrade.php index 8e6db05b5f..b5e09b8440 100644 --- a/mod/resource/db/upgrade.php +++ b/mod/resource/db/upgrade.php @@ -19,7 +19,7 @@ function xmldb_resource_upgrade($oldversion=0) { - global $CFG, $THEME, $db; + global $CFG, $THEME, $DB; $result = true; @@ -32,36 +32,7 @@ function xmldb_resource_upgrade($oldversion=0) { /// $result = result of "/lib/ddllib.php" function calls /// } - if ($result && $oldversion < 2007011700) { - //move format from options to reference field because it was colliding with course blocks setting - execute_sql("UPDATE {$CFG->prefix}resource SET reference=options WHERE type='text' AND reference='' AND options!='showblocks'"); - //ignore result - } - - if ($result && $oldversion < 2007012000) { - - /// Changing nullability of field summary on table resource to null - $table = new XMLDBTable('resource'); - $field = new XMLDBField('summary'); - $field->setAttributes(XMLDB_TYPE_TEXT, 'small', null, null, null, null, null, null, 'reference'); - - /// Launch change of nullability for field summary - $result = $result && change_field_notnull($table, $field); - } - - if ($result && $oldversion < 2007012001) { - - if ($CFG->dbfamily == 'mysql') { // Only needed under mysql. The rest are long texts since ages - - /// Changing precision of field alltext on table resource to (medium) - $table = new XMLDBTable('resource'); - $field = new XMLDBField('alltext'); - $field->setAttributes(XMLDB_TYPE_TEXT, 'medium', null, XMLDB_NOTNULL, null, null, null, null, 'summary'); - - /// Launch change of precision for field alltext - $result = $result && change_field_precision($table, $field); - } - } +//===== 1.9.0 upgrade line ======// return $result; } diff --git a/mod/scorm/db/upgrade.php b/mod/scorm/db/upgrade.php index 73c0145260..512cfcf45a 100644 --- a/mod/scorm/db/upgrade.php +++ b/mod/scorm/db/upgrade.php @@ -19,277 +19,11 @@ function xmldb_scorm_upgrade($oldversion=0) { - global $CFG, $THEME, $db; + global $CFG, $THEME, $DB; $result = true; - if ($result && $oldversion < 2006103100) { - /// Create the new sco optionals data table - - /// Define table scorm_scoes_data to be created - $table = new XMLDBTable('scorm_scoes_data'); - - /// Adding fields to table scorm_scoes_data - $table->addFieldInfo('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null); - $table->addFieldInfo('scoid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0'); - $table->addFieldInfo('name', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null, null, null); - $table->addFieldInfo('value', XMLDB_TYPE_TEXT, 'small', null, XMLDB_NOTNULL, null, null, null, null); - - /// Adding keys to table scorm_scoes_data - $table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id')); - - /// Adding indexes to table scorm_scoes_data - $table->addIndexInfo('scoid', XMLDB_INDEX_NOTUNIQUE, array('scoid')); - - /// Launch create table for scorm_scoes_data - $result = $result && create_table($table); - - /// The old fields used in scorm_scoes - $fields = array('parameters' => '', - 'prerequisites' => '', - 'maxtimeallowed' => '', - 'timelimitaction' => '', - 'datafromlms' => '', - 'masteryscore' => '', - 'next' => '0', - 'previous' => '0'); - - /// Retrieve old datas - if ($scorms = get_records('scorm')) { - foreach ($scorms as $scorm) { - if ($olddatas = get_records('scorm_scoes','scorm', $scorm->id)) { - foreach ($olddatas as $olddata) { - $newdata = new stdClass(); - $newdata->scoid = $olddata->id; - foreach ($fields as $field => $value) { - if ($olddata->$field != $value) { - $newdata->name = addslashes($field); - $newdata->value = addslashes($olddata->$field); - $id = insert_record('scorm_scoes_data', $newdata); - $result = $result && ($id != 0); - } - } - } - } - } - } - - /// Remove no more used fields - $table = new XMLDBTable('scorm_scoes'); - - foreach ($fields as $field => $value) { - $field = new XMLDBField($field); - $result = $result && drop_field($table, $field); - } - } - - if ($result && $oldversion < 2006120900) { - /// Define table scorm_seq_objective to be created - $table = new XMLDBTable('scorm_seq_objective'); - - /// Adding fields to table scorm_seq_objective - $table->addFieldInfo('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null); - $table->addFieldInfo('scoid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0'); - $table->addFieldInfo('primaryobj', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, null, null, '0'); - $table->addFieldInfo('objectiveid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0'); - $table->addFieldInfo('satisfiedbymeasure', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, null, null, '1'); - $table->addFieldInfo('minnormalizedmeasure', XMLDB_TYPE_FLOAT, '11, 4', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0.0000'); - - /// Adding keys to table scorm_seq_objective - $table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id')); - $table->addKeyInfo('scorm_objective_uniq', XMLDB_KEY_UNIQUE, array('scoid', 'id')); - $table->addKeyInfo('scorm_objective_scoid', XMLDB_KEY_FOREIGN, array('scoid'), 'scorm_scoes', array('id')); - - /// Launch create table for scorm_seq_objective - $result = $result && create_table($table); - - /// Define table scorm_seq_mapinfo to be created - $table = new XMLDBTable('scorm_seq_mapinfo'); - - /// Adding fields to table scorm_seq_mapinfo - $table->addFieldInfo('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null); - $table->addFieldInfo('scoid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0'); - $table->addFieldInfo('objectiveid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0'); - $table->addFieldInfo('targetobjectiveid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0'); - $table->addFieldInfo('readsatisfiedstatus', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, null, null, '1'); - $table->addFieldInfo('readnormalizedmeasure', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, null, null, '1'); - $table->addFieldInfo('writesatisfiedstatus', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, null, null, '0'); - $table->addFieldInfo('writenormalizedmeasure', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, null, null, '0'); - - /// Adding keys to table scorm_seq_mapinfo - $table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id')); - $table->addKeyInfo('scorm_mapinfo_uniq', XMLDB_KEY_UNIQUE, array('scoid', 'id', 'objectiveid')); - $table->addKeyInfo('scorm_mapinfo_scoid', XMLDB_KEY_FOREIGN, array('scoid'), 'scorm_scoes', array('id')); - $table->addKeyInfo('scorm_mapinfo_objectiveid', XMLDB_KEY_FOREIGN, array('objectiveid'), 'scorm_seq_objective', array('id')); - - /// Launch create table for scorm_seq_mapinfo - $result = $result && create_table($table); - - /// Define table scorm_seq_ruleconds to be created - $table = new XMLDBTable('scorm_seq_ruleconds'); - - /// Adding fields to table scorm_seq_ruleconds - $table->addFieldInfo('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null); - $table->addFieldInfo('scoid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0'); - $table->addFieldInfo('conditioncombination', XMLDB_TYPE_CHAR, '3', null, XMLDB_NOTNULL, null, null, null, 'all'); - $table->addFieldInfo('ruletype', XMLDB_TYPE_INTEGER, '2', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0'); - $table->addFieldInfo('action', XMLDB_TYPE_CHAR, '25', null, XMLDB_NOTNULL, null, null, null, null); - - /// Adding keys to table scorm_seq_ruleconds - $table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id')); - $table->addKeyInfo('scorm_ruleconds_un', XMLDB_KEY_UNIQUE, array('scoid', 'id')); - $table->addKeyInfo('scorm_ruleconds_scoid', XMLDB_KEY_FOREIGN, array('scoid'), 'scorm_scoes', array('id')); - - /// Launch create table for scorm_seq_ruleconds - $result = $result && create_table($table); - - /// Define table scorm_seq_rulecond to be created - $table = new XMLDBTable('scorm_seq_rulecond'); - - /// Adding fields to table scorm_seq_rulecond - $table->addFieldInfo('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null); - $table->addFieldInfo('scoid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0'); - $table->addFieldInfo('ruleconditionsid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0'); - $table->addFieldInfo('refrencedobjective', XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null, null, null); - $table->addFieldInfo('measurethreshold', XMLDB_TYPE_FLOAT, '11, 4', null, XMLDB_NOTNULL, null, null, null, '0.0000'); - $table->addFieldInfo('operator', XMLDB_TYPE_CHAR, '5', null, XMLDB_NOTNULL, null, null, null, 'noOp'); - $table->addFieldInfo('cond', XMLDB_TYPE_CHAR, '30', null, XMLDB_NOTNULL, null, null, null, 'always'); - - /// Adding keys to table scorm_seq_rulecond - $table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id')); - $table->addKeyInfo('scorm_rulecond_uniq', XMLDB_KEY_UNIQUE, array('id', 'scoid', 'ruleconditionsid')); - $table->addKeyInfo('scorm_rulecond_scoid', XMLDB_KEY_FOREIGN, array('scoid'), 'scorm_scoes', array('id')); - $table->addKeyInfo('scorm_rulecond_ruleconditionsid', XMLDB_KEY_FOREIGN, array('ruleconditionsid'), 'scorm_seq_ruleconds', array('id')); - - /// Launch create table for scorm_seq_rulecond - $result = $result && create_table($table); - - /// Define table scorm_seq_rolluprule to be created - $table = new XMLDBTable('scorm_seq_rolluprule'); - - /// Adding fields to table scorm_seq_rolluprule - $table->addFieldInfo('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null); - $table->addFieldInfo('scoid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0'); - $table->addFieldInfo('childactivityset', XMLDB_TYPE_CHAR, '15', null, XMLDB_NOTNULL, null, null, null, null); - $table->addFieldInfo('minimumcount', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0'); - $table->addFieldInfo('minimumpercent', XMLDB_TYPE_FLOAT, '11, 4', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0.0000'); - $table->addFieldInfo('conditioncombination', XMLDB_TYPE_CHAR, '3', null, XMLDB_NOTNULL, null, null, null, 'all'); - $table->addFieldInfo('action', XMLDB_TYPE_CHAR, '15', null, XMLDB_NOTNULL, null, null, null, null); - - /// Adding keys to table scorm_seq_rolluprule - $table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id')); - $table->addKeyInfo('scorm_rolluprule_uniq', XMLDB_KEY_UNIQUE, array('scoid', 'id')); - $table->addKeyInfo('scorm_rolluprule_scoid', XMLDB_KEY_FOREIGN, array('scoid'), 'scorm_scoes', array('id')); - - /// Launch create table for scorm_seq_rolluprule - $result = $result && create_table($table); - - /// Define table scorm_seq_rolluprulecond to be created - $table = new XMLDBTable('scorm_seq_rolluprulecond'); - - /// Adding fields to table scorm_seq_rolluprulecond - $table->addFieldInfo('id', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, XMLDB_SEQUENCE, null, null, null); - $table->addFieldInfo('scoid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0'); - $table->addFieldInfo('rollupruleid', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0'); - $table->addFieldInfo('operator', XMLDB_TYPE_CHAR, '5', null, XMLDB_NOTNULL, null, null, null, 'noOp'); - $table->addFieldInfo('cond', XMLDB_TYPE_CHAR, '25', null, XMLDB_NOTNULL, null, null, null, null); - - /// Adding keys to table scorm_seq_rolluprulecond - $table->addKeyInfo('primary', XMLDB_KEY_PRIMARY, array('id')); - $table->addKeyInfo('scorm_rulluprulecond_uniq', XMLDB_KEY_UNIQUE, array('scoid', 'rollupruleid', 'id')); - $table->addKeyInfo('scorm_rolluprulecond_scoid', XMLDB_KEY_FOREIGN, array('scoid'), 'scorm_scoes', array('id')); - $table->addKeyInfo('scorm_rolluprulecond_rolluprule', XMLDB_KEY_FOREIGN, array('rollupruleid'), 'scorm_seq_rolluprule', array('id')); - - /// Launch create table for scorm_seq_rolluprulecond - $result = $result && create_table($table); - } - - //Adding new field to table scorm - if ($result && $oldversion < 2007011800) { - - /// Define field format to be added to data_comments - $table = new XMLDBTable('scorm'); - $field = new XMLDBField('md5_result'); - $field->setAttributes(XMLDB_TYPE_CHAR, '32' , null, null, null, null, null, null, null); - - /// Launch add field format - $result = $result && add_field($table, $field); - - $field = new XMLDBField('external'); - $field->setAttributes(XMLDB_TYPE_INTEGER, '2', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', null); - - $result = $result && add_field($table, $field); - } - - if ($result && $oldversion < 2007012400) { - - /// Rename field external on table scorm to updatefreq - $table = new XMLDBTable('scorm'); - $field = new XMLDBField('external'); - - if (field_exists($table, $field)) { - $field->setAttributes(XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'maxattempt'); - - /// Launch rename field updatefreq - $result = $result && rename_field($table, $field, 'updatefreq'); - } else { - $field = new XMLDBField('updatefreq'); - $field->setAttributes(XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'maxattempt'); - - $result = $result && add_field($table, $field); - } - - /// Rename field md5_result on table scorm to md5hash - $field = new XMLDBField('md5_result'); - if (field_exists($table, $field)) { - $field->setAttributes(XMLDB_TYPE_CHAR, '32', null, XMLDB_NOTNULL, null, null, null, null, 'updatefreq'); - - /// Launch rename field md5hash - $result = $result && rename_field($table, $field, 'md5hash'); - } else { - $field = new XMLDBField('md5hash'); - $field->setAttributes(XMLDB_TYPE_CHAR, '32', null, XMLDB_NOTNULL, null, null, null, '', 'updatefreq'); - - $result = $result && add_field($table, $field); - } - } - - if ($result && $oldversion < 2007031300) { - if ($scorms = get_records('scorm')) { - foreach ($scorms as $scorm) { - if ($scoes = get_records('scorm_scoes','scorm',$scorm->id)) { - foreach ($scoes as $sco) { - if ($tracks = get_records('scorm_scoes_track','scoid',$sco->id)) { - foreach ($tracks as $track) { - $element = preg_replace('/\.N(\d+)\./',".\$1.",$track->element); - if ($track->element != $element) { - $track->element = $element; - update_record('scorm_scoes_track',$track); - } - } - } - } - } - } - } - } - - if ($result && $oldversion < 2007081001) { - require_once($CFG->dirroot.'/mod/scorm/lib.php'); - // too much debug output - $db->debug = false; - scorm_update_grades(); - $db->debug = true; - } - - // Adding missing 'version' field to table scorm - if ($result && $oldversion < 2007110500) { - $table = new XMLDBTable('scorm'); - $field = new XMLDBField('version'); - $field->setAttributes(XMLDB_TYPE_CHAR, '9', null, XMLDB_NOTNULL, null, null, null, 'scorm_12', 'summary'); - - $result = $result && add_field($table, $field); - } +//===== 1.9.0 upgrade line ======// return $result; } diff --git a/mod/survey/db/upgrade.php b/mod/survey/db/upgrade.php index 75a3e5f042..9c652cf734 100644 --- a/mod/survey/db/upgrade.php +++ b/mod/survey/db/upgrade.php @@ -19,7 +19,7 @@ function xmldb_survey_upgrade($oldversion=0) { - global $CFG, $THEME, $db; + global $CFG, $THEME, $DB; $result = true; @@ -32,6 +32,8 @@ function xmldb_survey_upgrade($oldversion=0) { /// $result = result of "/lib/ddllib.php" function calls /// } +//===== 1.9.0 upgrade line ======// + return $result; } diff --git a/mod/wiki/db/upgrade.php b/mod/wiki/db/upgrade.php index 3664109a35..b2686a947e 100644 --- a/mod/wiki/db/upgrade.php +++ b/mod/wiki/db/upgrade.php @@ -19,7 +19,7 @@ function xmldb_wiki_upgrade($oldversion=0) { - global $CFG, $THEME, $db; + global $CFG, $THEME, $DB; $result = true; @@ -32,6 +32,8 @@ function xmldb_wiki_upgrade($oldversion=0) { /// $result = result of "/lib/ddllib.php" function calls /// } +//===== 1.9.0 upgrade line ======// + return $result; } diff --git a/question/type/calculated/db/upgrade.php b/question/type/calculated/db/upgrade.php index 76289e8a5a..8cb1fe8611 100644 --- a/question/type/calculated/db/upgrade.php +++ b/question/type/calculated/db/upgrade.php @@ -19,7 +19,7 @@ function xmldb_qtype_calculated_upgrade($oldversion=0) { - global $CFG, $THEME, $db; + global $CFG, $THEME, $DB; $result = true; diff --git a/question/type/essay/db/upgrade.php b/question/type/essay/db/upgrade.php index 97fa363608..bdf553fb5e 100644 --- a/question/type/essay/db/upgrade.php +++ b/question/type/essay/db/upgrade.php @@ -19,7 +19,7 @@ function xmldb_qtype_essay_upgrade($oldversion=0) { - global $CFG, $THEME, $db; + global $CFG, $THEME, $DB; $result = true; diff --git a/question/type/match/db/upgrade.php b/question/type/match/db/upgrade.php index a6d153b3f7..d18ea5fcfe 100644 --- a/question/type/match/db/upgrade.php +++ b/question/type/match/db/upgrade.php @@ -19,7 +19,7 @@ function xmldb_qtype_match_upgrade($oldversion=0) { - global $CFG, $THEME, $db; + global $CFG, $THEME, $DB; $result = true; diff --git a/question/type/multianswer/db/upgrade.php b/question/type/multianswer/db/upgrade.php index eb3abaf257..1ae2413370 100644 --- a/question/type/multianswer/db/upgrade.php +++ b/question/type/multianswer/db/upgrade.php @@ -19,7 +19,7 @@ function xmldb_qtype_multianswer_upgrade($oldversion=0) { - global $CFG, $THEME, $db; + global $CFG, $THEME, $DB; $result = true; diff --git a/question/type/randomsamatch/db/upgrade.php b/question/type/randomsamatch/db/upgrade.php index 0934fb6a07..8c315e1475 100644 --- a/question/type/randomsamatch/db/upgrade.php +++ b/question/type/randomsamatch/db/upgrade.php @@ -19,7 +19,7 @@ function xmldb_qtype_randomsamatch_upgrade($oldversion=0) { - global $CFG, $THEME, $db; + global $CFG, $THEME, $DB; $result = true; diff --git a/question/type/shortanswer/db/upgrade.php b/question/type/shortanswer/db/upgrade.php index c230b2ecdf..f245002805 100644 --- a/question/type/shortanswer/db/upgrade.php +++ b/question/type/shortanswer/db/upgrade.php @@ -19,7 +19,7 @@ function xmldb_qtype_shortanswer_upgrade($oldversion=0) { - global $CFG, $THEME, $db; + global $CFG, $THEME, $DB; $result = true; diff --git a/question/type/truefalse/db/upgrade.php b/question/type/truefalse/db/upgrade.php index 8a45e703d6..2c71db48b7 100644 --- a/question/type/truefalse/db/upgrade.php +++ b/question/type/truefalse/db/upgrade.php @@ -19,7 +19,7 @@ function xmldb_qtype_truefalse_upgrade($oldversion=0) { - global $CFG, $THEME, $db; + global $CFG, $THEME, $DB; $result = true; -- 2.39.5