Browse Source

Merge pull request #33 from University-of-Strathclyde-LTE-Team/issue-32

Get version from config if necessary
MOODLE_26_STABLE
Dan Marsden 11 years ago
parent
commit
80ece9b440
  1. 12
      locallib.php

12
locallib.php

@ -1511,6 +1511,14 @@ function att_log_convert_url(moodle_url $fullurl) {
function attforblock_upgrade() { function attforblock_upgrade() {
global $DB, $CFG; global $DB, $CFG;
$module = $DB->get_record('modules', array('name' => 'attforblock')); $module = $DB->get_record('modules', array('name' => 'attforblock'));
// Deal with Moodle versions above 2013092001.02, where version is in config
$versioninmodtable = true;
if (!isset($module->version)) {
$versioninmodtable = false;
$module->version = get_config('mod_attforblock', 'version');
}
if ($module->version <= '2011061800') { if ($module->version <= '2011061800') {
print_error("noupgradefromthisversion", 'attendance'); print_error("noupgradefromthisversion", 'attendance');
} }
@ -1529,6 +1537,10 @@ function attforblock_upgrade() {
} }
// Now convert module record. // Now convert module record.
$module->name = 'attendance'; $module->name = 'attendance';
if (!$versioninmodtable) {
set_config('version', $module->version, 'mod_attendance');
unset($module->version);
}
$DB->update_record('modules', $module); $DB->update_record('modules', $module);
// Now convert grade items to 'attendance' // Now convert grade items to 'attendance'

Loading…
Cancel
Save