$dbman->create_table($table);
}
- //pull in the ratings from the modules into the central rating table
-
- //migrate forumratings
- //forum ratings only have a single time column so use it for both time created and modified
- $ratingssql = 'SELECT r.id AS rid, r.post AS itemid, r.rating, r.userid, r.time AS timecreated, r.time AS timemodified, f.scale, f.id AS mid
-FROM {forum_ratings} r
-JOIN {forum_posts} p on p.id=r.post
-JOIN {forum_discussions} d on d.id=p.discussion
-JOIN {forum} f on f.id=d.forum';
- $result = $result && upgrade_module_ratings($ratingssql,'forum');
-
- //migrate glossary_ratings
- //glossary ratings only have a single time column so use it for both time created and modified
- $ratingssql = 'SELECT r.id AS rid, r.entryid AS itemid, r.rating, r.userid, r.time AS timecreated, r.time AS timemodified, g.scale, g.id AS mid
-FROM {glossary_ratings} r
-JOIN {glossary_entries} ge ON ge.id=r.entryid
-JOIN {glossary} g ON g.id=ge.glossaryid';
- $result = $result && upgrade_module_ratings($ratingssql,'glossary');
-
- //migrate data_ratings
- //data ratings didnt store time created and modified so Im using the times from the record the rating was attached to
- $ratingssql = 'SELECT r.id AS rid, r.recordid AS itemid, r.rating, r.userid, re.timecreated, re.timemodified, d.scale, d.id AS mid
-FROM {data_ratings} r
-JOIN {data_records} re ON r.recordid=re.id
-JOIN {data} d ON d.id=re.dataid';
- $result = $result && upgrade_module_ratings($ratingssql,'data');
-
- //todo drop forum_ratings, data_ratings and glossary_ratings
-
upgrade_main_savepoint($result, 2010031800);
}
upgrade_mod_savepoint($result, 2010031602, 'data');
}
+ if($result && $oldversion < 2010031800) {
+ //migrate data_ratings to the central rating table
+ //data ratings didnt store time created and modified so Im using the times from the record the rating was attached to
+ $ratingssql = 'SELECT r.id AS rid, r.recordid AS itemid, r.rating, r.userid, re.timecreated, re.timemodified, d.scale, d.id AS mid
+FROM {data_ratings} r
+JOIN {data_records} re ON r.recordid=re.id
+JOIN {data} d ON d.id=re.dataid';
+ $result = $result && upgrade_module_ratings($ratingssql,'data');
+
+ //todo andrew drop data_ratings
+
+ upgrade_mod_savepoint($result, 2010031800, 'data');
+ }
+
return $result;
}
// This fragment is called by /admin/index.php
////////////////////////////////////////////////////////////////////////////////
-$module->version = 2009111701;
-$module->requires = 2009041700; // Requires this Moodle version
+$module->version = 2010031800;
+$module->requires = 2010031800; // Requires this Moodle version
$module->cron = 60;
upgrade_mod_savepoint($result, 2009050400, 'forum');
}
+ if($result && $oldversion < 2010031800) {
+ //migrate forumratings to the central rating table
+ //forum ratings only have a single time column so use it for both time created and modified
+ $ratingssql = 'SELECT r.id AS rid, r.post AS itemid, r.rating, r.userid, r.time AS timecreated, r.time AS timemodified, f.scale, f.id AS mid
+FROM {forum_ratings} r
+JOIN {forum_posts} p on p.id=r.post
+JOIN {forum_discussions} d on d.id=p.discussion
+JOIN {forum} f on f.id=d.forum';
+ $result = $result && upgrade_module_ratings($ratingssql,'forum');
+
+ //todo andrew drop forum_ratings
+
+ upgrade_mod_savepoint($result, 2010031800, 'forum');
+ }
+
return $result;
}
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-$module->version = 2009050400;
-$module->requires = 2009041700; // Requires this Moodle version
+$module->version = 2010031800;
+$module->requires = 2010031800; // Requires this Moodle version
$module->cron = 60;
upgrade_mod_savepoint($result, 2009110800, 'glossary');
}
- //todo andrew set rating permissions based on current value of glossary.assessed
+ if($result && $oldversion < 2010031800) {
+ //migrate glossary_ratings to the central rating table
+ //glossary ratings only have a single time column so use it for both time created and modified
+ $ratingssql = 'SELECT r.id AS rid, r.entryid AS itemid, r.rating, r.userid, r.time AS timecreated, r.time AS timemodified, g.scale, g.id AS mid
+FROM {glossary_ratings} r
+JOIN {glossary_entries} ge ON ge.id=r.entryid
+JOIN {glossary} g ON g.id=ge.glossaryid';
+ $result = $result && upgrade_module_ratings($ratingssql,'glossary');
+
+ //todo andrew drop glossary_ratings
+
+ //todo andrew set rating permissions based on current value of glossary.assessed
+
+ upgrade_mod_savepoint($result, 2010031800, 'glossary');
+ }
return $result;
}
/// This fragment is called by moodle_needs_upgrading() and /admin/index.php
/////////////////////////////////////////////////////////////////////////////////
-$module->version = 2009110800;
-$module->requires = 2009041700; // Requires this Moodle version
+$module->version = 2010031800;
+$module->requires = 2010031800; // Requires this Moodle version
$module->cron = 0; // Period for cron to check this module (secs)