weekly on-sync release 2.6dev
[moodle.git] / mod / scorm / db / upgrade.php
CommitLineData
e5dd8e3b 1<?php
f7b5c6aa 2// This file is part of Moodle - http://moodle.org/
b8a342d7 3//
f7b5c6aa
DM
4// Moodle is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
b8a342d7 8//
f7b5c6aa
DM
9// Moodle is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
b8a342d7 13//
f7b5c6aa
DM
14// You should have received a copy of the GNU General Public License
15// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
16
17/**
18 * Upgrade script for the scorm module.
19 *
20 * @package mod
21 * @subpackage scorm
22 * @copyright 1999 onwards Martin Dougiamas {@link http://moodle.com}
23 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
24 */
25
b8a342d7 26
b964171c
SH
27/**
28 * @global moodle_database $DB
29 * @param int $oldversion
30 * @return bool
31 */
775f811a 32function xmldb_scorm_upgrade($oldversion) {
33 global $CFG, $DB;
b8a342d7 34
c57ce9f2 35 $dbman = $DB->get_manager();
b8a342d7 36
ba0e91a2 37
46f2a936
AB
38 // Moodle v2.2.0 release upgrade line
39 // Put any upgrade step following this
40
0a466048 41 if ($oldversion < 2012032100) {
94db2749 42 unset_config('updatetime', 'scorm');
0a466048 43 upgrade_mod_savepoint(true, 2012032100, 'scorm');
94db2749
AB
44 }
45
46 // Adding completion fields to scorm table
0a466048 47 if ($oldversion < 2012032101) {
94db2749
AB
48 $table = new xmldb_table('scorm');
49
50 $field = new xmldb_field('completionstatusrequired', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, null, null, null, 'timemodified');
51 if (!$dbman->field_exists($table, $field)) {
52 $dbman->add_field($table, $field);
53 }
54
55 $field = new xmldb_field('completionscorerequired', XMLDB_TYPE_INTEGER, '2', XMLDB_UNSIGNED, null, null, null, 'completionstatusrequired');
56 if (!$dbman->field_exists($table, $field)) {
57 $dbman->add_field($table, $field);
58 }
59
0a466048 60 upgrade_mod_savepoint(true, 2012032101, 'scorm');
94db2749
AB
61 }
62
99c3c503
AB
63 // Moodle v2.3.0 release upgrade line
64 // Put any upgrade step following this
65
e0d90c54
DM
66 //rename config var from maxattempts to maxattempt
67 if ($oldversion < 2012061701) {
68 $maxattempts = get_config('scorm', 'maxattempts');
69 $maxattempts_adv = get_config('scorm', 'maxattempts_adv');
70 set_config('maxattempt', $maxattempts, 'scorm');
71 set_config('maxattempt_adv', $maxattempts_adv, 'scorm');
72
73 unset_config('maxattempts', 'scorm'); //remove old setting.
74 unset_config('maxattempts_adv', 'scorm'); //remove old setting.
75 upgrade_mod_savepoint(true, 2012061701, 'scorm');
76 }
77
99c3c503 78
6b9dfe73
EL
79 // Moodle v2.4.0 release upgrade line
80 // Put any upgrade step following this
81
82
c9e54743
EL
83 // Moodle v2.5.0 release upgrade line.
84 // Put any upgrade step following this.
85
86
a4cdd6d2 87 return true;
b8a342d7 88}
89
e5dd8e3b 90