Merge branch 'master_MDL-44753' of git://github.com/danmarsden/moodle

This commit is contained in:
Marina Glancy 2014-04-02 09:15:33 +08:00
commit cc7c745c7d
3 changed files with 36 additions and 26 deletions

View file

@ -199,6 +199,16 @@ class restore_scorm_activity_structure_step extends restore_activity_structure_s
$scormid = $this->get_new_parentid('scorm'); $scormid = $this->get_new_parentid('scorm');
$scorm = $DB->get_record('scorm', array('id' => $scormid)); $scorm = $DB->get_record('scorm', array('id' => $scormid));
$scorm->launch = $this->get_mappingid('scorm_sco', $scorm->launch, ''); $scorm->launch = $this->get_mappingid('scorm_sco', $scorm->launch, '');
if (!empty($scorm->launch)) {
// Check that this sco has a valid launch value.
$scolaunch = $DB->get_field('scorm_scoes', 'launch', array('id' => $scorm->launch));
if (empty($scolaunch)) {
// This is not a valid sco - set to empty so we can find a valid launch sco.
$scorm->launch = '';
}
}
if (empty($scorm->launch)) { if (empty($scorm->launch)) {
// This scorm has an invalid launch param - we need to calculate it and get the first launchable sco. // This scorm has an invalid launch param - we need to calculate it and get the first launchable sco.
$sqlselect = 'scorm = ? AND '.$DB->sql_isnotempty('scorm_scoes', 'launch', false, true); $sqlselect = 'scorm = ? AND '.$DB->sql_isnotempty('scorm_scoes', 'launch', false, true);

View file

@ -202,7 +202,30 @@ function xmldb_scorm_upgrade($oldversion) {
upgrade_mod_savepoint(true, 2013110501, 'scorm'); upgrade_mod_savepoint(true, 2013110501, 'scorm');
} }
if ($oldversion < 2014021700) { if ($oldversion < 2014031700) {
// Define field displayactivityname to be added to scorm.
$table = new xmldb_table('scorm');
$field = new xmldb_field(
'displayactivityname',
XMLDB_TYPE_INTEGER,
'4',
null,
XMLDB_NOTNULL,
null,
'1',
'completionscorerequired'
);
// Conditionally launch add field displayactivityname.
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
// Scorm savepoint reached.
upgrade_mod_savepoint(true, 2014031700, 'scorm');
}
if ($oldversion < 2014040200) {
// Fix invalid $scorm->launch records that launch an org sco instead of a real sco. // Fix invalid $scorm->launch records that launch an org sco instead of a real sco.
$sql = "SELECT s.*, c.identifier $sql = "SELECT s.*, c.identifier
FROM {scorm} s FROM {scorm} s
@ -249,30 +272,7 @@ function xmldb_scorm_upgrade($oldversion) {
} }
$scorms->close(); $scorms->close();
upgrade_mod_savepoint(true, 2014021700, 'scorm'); upgrade_mod_savepoint(true, 2014040200, 'scorm');
}
if ($oldversion < 2014031700) {
// Define field displayactivityname to be added to scorm.
$table = new xmldb_table('scorm');
$field = new xmldb_field(
'displayactivityname',
XMLDB_TYPE_INTEGER,
'4',
null,
XMLDB_NOTNULL,
null,
'1',
'completionscorerequired'
);
// Conditionally launch add field displayactivityname.
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
// Scorm savepoint reached.
upgrade_mod_savepoint(true, 2014031700, 'scorm');
} }
return true; return true;

View file

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