b8a342d7 |
1 | <?php //$Id$ |
2 | |
3 | // This file keeps track of upgrades to |
4 | // the scorm module |
5 | // |
6 | // Sometimes, changes between versions involve |
7 | // alterations to database structures and other |
8 | // major things that may break installations. |
9 | // |
10 | // The upgrade function in this file will attempt |
11 | // to perform all the necessary actions to upgrade |
12 | // your older installtion to the current version. |
13 | // |
14 | // If there's something it cannot do itself, it |
15 | // will tell you what you need to do. |
16 | // |
17 | // The commands in here will all be database-neutral, |
b1f93b15 |
18 | // using the methods of database_manager class |
775f811a |
19 | // |
20 | // Please do not forget to use upgrade_set_timeout() |
21 | // before any action that may take longer time to finish. |
b8a342d7 |
22 | |
775f811a |
23 | function xmldb_scorm_upgrade($oldversion) { |
24 | global $CFG, $DB; |
b8a342d7 |
25 | |
c57ce9f2 |
26 | $dbman = $DB->get_manager(); |
b8a342d7 |
27 | $result = true; |
28 | |
219f652b |
29 | //===== 1.9.0 upgrade line ======// |
9858605e |
30 | |
c57ce9f2 |
31 | // Adding missing 'whatgrade' field to table scorm |
32 | if ($result && $oldversion < 2008073000) { |
33 | $table = new xmldb_table('scorm'); |
34 | $field = new xmldb_field('whatgrade'); |
35 | $field->set_attributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'grademethod'); |
36 | |
37 | /// Launch add field whatgrade |
775f811a |
38 | if (!$dbman->field_exists($table,$field)) { |
c57ce9f2 |
39 | $dbman->add_field($table, $field); |
40 | } |
41 | |
42 | upgrade_mod_savepoint($result, 2008073000, 'scorm'); |
43 | } |
44 | |
b8a342d7 |
45 | return $result; |
46 | } |
47 | |
c57ce9f2 |
48 | ?> |