MDL-51363 SCORM: fixed default settings on restoring 1.x backups

This commit is contained in:
Matteo Scaramuccia 2015-09-09 16:26:47 +02:00
parent f495510548
commit 32c114ca04
4 changed files with 22 additions and 5 deletions

View File

@ -57,11 +57,11 @@ class moodle1_mod_scorm_handler extends moodle1_mod_handler {
'scormtype' => 'local',
'sha1hash' => null,
'revision' => '0',
'forcecompleted' => 1,
'forcecompleted' => 0,
'forcenewattempt' => 0,
'lastattemptlock' => 0,
'displayattemptstatus' => 1,
'displaycoursestructure' => 1,
'displaycoursestructure' => 0,
'timeopen' => '0',
'timeclose' => '0',
'introformat' => '0',

View File

@ -18,11 +18,11 @@
<FIELD NAME="grademethod" TYPE="int" LENGTH="2" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="whatgrade" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="maxattempt" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="1" SEQUENCE="false"/>
<FIELD NAME="forcecompleted" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1" SEQUENCE="false"/>
<FIELD NAME="forcecompleted" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="forcenewattempt" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="lastattemptlock" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="displayattemptstatus" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1" SEQUENCE="false"/>
<FIELD NAME="displaycoursestructure" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1" SEQUENCE="false"/>
<FIELD NAME="displaycoursestructure" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="updatefreq" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Define when the package must be automatically update"/>
<FIELD NAME="sha1hash" TYPE="char" LENGTH="40" NOTNULL="false" SEQUENCE="false" COMMENT="package content or ext path hash"/>
<FIELD NAME="md5hash" TYPE="char" LENGTH="32" NOTNULL="true" SEQUENCE="false" COMMENT="MD5 Hash of package file"/>

View File

@ -318,6 +318,23 @@ function xmldb_scorm_upgrade($oldversion) {
// Moodle v2.9.0 release upgrade line.
// Put any upgrade step following this.
if ($oldversion < 2015091400) {
$table = new xmldb_table('scorm');
// Changing the default of field forcecompleted on table scorm to 0.
$field = new xmldb_field('forcecompleted', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '0', 'maxattempt');
// Launch change of default for field forcecompleted.
$dbman->change_field_default($table, $field);
// Changing the default of field displaycoursestructure on table scorm to 0.
$field = new xmldb_field('displaycoursestructure', XMLDB_TYPE_INTEGER, '1', null, XMLDB_NOTNULL, null, '0', 'displayattemptstatus');
// Launch change of default for field displaycoursestructure.
$dbman->change_field_default($table, $field);
// Scorm savepoint reached.
upgrade_mod_savepoint(true, 2015091400, 'scorm');
}
return true;
}

View File

@ -24,7 +24,7 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2015051102; // The current module version (Date: YYYYMMDDXX).
$plugin->version = 2015091400; // The current module version (Date: YYYYMMDDXX).
$plugin->requires = 2015050500; // Requires this Moodle version.
$plugin->component = 'mod_scorm'; // Full name of the plugin (used for diagnostics).
$plugin->cron = 300;