. /** * Keeps track of upgrades to the workshop accumulative grading strategy * * @package workshopform * @subpackage accumulative * @copyright 2010 David Mudrak * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ /** * Performs upgrade of the database structure and data * * @param int $oldversion the version we are upgrading from * @return bool true */ function xmldb_workshopform_accumulative_upgrade($oldversion) { global $CFG, $DB, $OUTPUT; $dbman = $DB->get_manager(); if ($oldversion < 2010091700) { // clean up orphaned dimensions $orphans = $DB->get_records_sql("SELECT d.id FROM {workshopform_accumulative} d LEFT JOIN {workshop} w ON d.workshopid = w.id WHERE w.id IS NULL"); if (!empty($orphans)) { echo $OUTPUT->notification('Orphaned assessment form elements found - cleaning...'); $DB->delete_records_list('workshopform_accumulative', 'id', array_keys($orphans)); } upgrade_plugin_savepoint(true, 2010091700, 'workshopform', 'accumulative'); } // Moodle v2.1.0 release upgrade line // Put any upgrade step following this // Moodle v2.2.0 release upgrade line // Put any upgrade step following this return true; }