MDL-41436 Remove DB fields course.modinfo and sectioncache
authorMarina Glancy <marina@moodle.com>
Wed, 28 Aug 2013 03:54:26 +0000 (13:54 +1000)
committerMarina Glancy <marina@moodle.com>
Tue, 10 Sep 2013 04:11:52 +0000 (14:11 +1000)
lib/db/install.xml
lib/db/upgrade.php
lib/setuplib.php
lib/upgrade.txt
version.php

index e2e4b58..8095fae 100644 (file)
@@ -79,8 +79,6 @@
         <FIELD NAME="summaryformat" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
         <FIELD NAME="format" TYPE="char" LENGTH="21" NOTNULL="true" DEFAULT="topics" SEQUENCE="false"/>
         <FIELD NAME="showgrades" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="1" SEQUENCE="false"/>
-        <FIELD NAME="sectioncache" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
-        <FIELD NAME="modinfo" TYPE="text" NOTNULL="false" SEQUENCE="false"/>
         <FIELD NAME="newsitems" TYPE="int" LENGTH="5" NOTNULL="true" DEFAULT="1" SEQUENCE="false"/>
         <FIELD NAME="startdate" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
         <FIELD NAME="marker" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
index cb3f716..1fad3d4 100644 (file)
@@ -2401,5 +2401,28 @@ function xmldb_main_upgrade($oldversion) {
         upgrade_main_savepoint(true, 2013091000.02);
     }
 
+    if ($oldversion < 2013091000.03) {
+
+        // Define field modinfo to be dropped from course.
+        $table = new xmldb_table('course');
+        $field = new xmldb_field('modinfo');
+
+        // Conditionally launch drop field modinfo.
+        if ($dbman->field_exists($table, $field)) {
+            $dbman->drop_field($table, $field);
+        }
+
+        // Define field sectioncache to be dropped from course.
+        $field = new xmldb_field('sectioncache');
+
+        // Conditionally launch drop field sectioncache.
+        if ($dbman->field_exists($table, $field)) {
+            $dbman->drop_field($table, $field);
+        }
+
+        // Main savepoint reached.
+        upgrade_main_savepoint(true, 2013091000.03);
+    }
+
     return true;
 }
index 5da953a..492eb96 100644 (file)
@@ -1174,7 +1174,7 @@ function disable_output_buffering() {
  */
 function redirect_if_major_upgrade_required() {
     global $CFG;
-    $lastmajordbchanges = 2013090900.00;
+    $lastmajordbchanges = 2013091000.03;
     if (empty($CFG->version) or (float)$CFG->version < $lastmajordbchanges or
             during_initial_install() or !empty($CFG->adminsetuppending)) {
         try {
index 6ecf4d1..550f271 100644 (file)
@@ -27,6 +27,11 @@ information provided here is intended especially for developers.
   function that returns an approximate number of entries in the zip faster than the count() function.
 * Class cm_info no longer extends stdClass. All properties are read-only and calculated on first request only.
 * Class course_modinfo no longer extends stdClass. All properties are read-only.
+* Database fields modinfo and sectioncache in table course are removed. Application cache core/coursemodinfo
+  is used instead. Course cache is still reset, rebuilt and retrieved using function rebuild_course_cache() and
+  get_fast_modinfo(). Purging all caches and every core upgrade purges course modinfo cache as well.
+  If function get_fast_modinfo() is called for multiple courses make sure to include field cacherev in course
+  object.
 
 DEPRECATIONS:
 Various previously deprecated functions have now been altered to throw DEBUG_DEVELOPER debugging notices
@@ -98,6 +103,7 @@ Misc:
     * mygroupid()                           -> groups_get_all_groups()
     * js_minify()                           -> core_minify::js_files()
     * css_minify_css()                      -> core_minify::css_files()
+    * course_modinfo::build_section_cache() -> (no replacement)
 
 User-agent related functions:
     * check_browser_operating_system()      -> core_useragent::check_browser_operating_system()
index 8627953..ec0fb5c 100644 (file)
@@ -29,7 +29,7 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$version  = 2013091000.02;              // YYYYMMDD      = weekly release date of this DEV branch.
+$version  = 2013091000.03;              // YYYYMMDD      = weekly release date of this DEV branch.
                                         //         RR    = release increments - 00 in DEV branches.
                                         //           .XX = incremental changes.