mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 17:06:53 +02:00
Merge branch 'master_MDL-44753' of git://github.com/danmarsden/moodle
This commit is contained in:
commit
cc7c745c7d
3 changed files with 36 additions and 26 deletions
|
@ -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);
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue