2009-11-01 14:55:15 +00:00
|
|
|
<?php
|
2006-10-26 17:33:40 +00:00
|
|
|
|
2009-11-01 14:55:15 +00:00
|
|
|
// This file keeps track of upgrades to
|
2006-10-26 17:33:40 +00:00
|
|
|
// the choice module
|
|
|
|
//
|
|
|
|
// Sometimes, changes between versions involve
|
|
|
|
// alterations to database structures and other
|
|
|
|
// major things that may break installations.
|
|
|
|
//
|
|
|
|
// The upgrade function in this file will attempt
|
|
|
|
// to perform all the necessary actions to upgrade
|
|
|
|
// your older installtion to the current version.
|
|
|
|
//
|
|
|
|
// If there's something it cannot do itself, it
|
|
|
|
// will tell you what you need to do.
|
|
|
|
//
|
|
|
|
// The commands in here will all be database-neutral,
|
2008-06-15 10:32:50 +00:00
|
|
|
// using the methods of database_manager class
|
2008-08-16 12:16:01 +00:00
|
|
|
//
|
|
|
|
// Please do not forget to use upgrade_set_timeout()
|
|
|
|
// before any action that may take longer time to finish.
|
2006-10-26 17:33:40 +00:00
|
|
|
|
2008-08-16 12:16:01 +00:00
|
|
|
function xmldb_choice_upgrade($oldversion) {
|
|
|
|
global $CFG, $DB;
|
2006-10-26 17:33:40 +00:00
|
|
|
|
2008-08-16 12:16:01 +00:00
|
|
|
$dbman = $DB->get_manager();
|
2006-10-26 17:33:40 +00:00
|
|
|
|
2008-05-31 18:05:42 +00:00
|
|
|
//===== 1.9.0 upgrade line ======//
|
|
|
|
|
2010-07-04 10:27:56 +00:00
|
|
|
if ($oldversion < 2009042000) {
|
2009-04-20 18:45:31 +00:00
|
|
|
|
|
|
|
/// Rename field text on table choice to NEWNAMEGOESHERE
|
|
|
|
$table = new xmldb_table('choice');
|
2009-05-01 01:19:16 +00:00
|
|
|
$field = new xmldb_field('text', XMLDB_TYPE_TEXT, 'small', null, XMLDB_NOTNULL, null, null, 'name');
|
2009-04-20 18:45:31 +00:00
|
|
|
|
|
|
|
/// Launch rename field text
|
|
|
|
$dbman->rename_field($table, $field, 'intro');
|
|
|
|
|
|
|
|
/// choice savepoint reached
|
2010-07-04 10:27:56 +00:00
|
|
|
upgrade_mod_savepoint(true, 2009042000, 'choice');
|
2009-04-20 18:45:31 +00:00
|
|
|
}
|
|
|
|
|
2010-07-04 10:27:56 +00:00
|
|
|
if ($oldversion < 2009042001) {
|
2009-04-20 18:45:31 +00:00
|
|
|
|
|
|
|
/// Rename field format on table choice to NEWNAMEGOESHERE
|
|
|
|
$table = new xmldb_table('choice');
|
2009-05-01 01:19:16 +00:00
|
|
|
$field = new xmldb_field('format', XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '0', 'intro');
|
2009-04-20 18:45:31 +00:00
|
|
|
|
|
|
|
/// Launch rename field format
|
|
|
|
$dbman->rename_field($table, $field, 'introformat');
|
|
|
|
|
|
|
|
/// choice savepoint reached
|
2010-07-04 10:27:56 +00:00
|
|
|
upgrade_mod_savepoint(true, 2009042001, 'choice');
|
2009-04-20 18:45:31 +00:00
|
|
|
}
|
|
|
|
|
2010-07-04 10:27:56 +00:00
|
|
|
return true;
|
2006-10-26 17:33:40 +00:00
|
|
|
}
|
|
|
|
|
2009-11-01 14:55:15 +00:00
|
|
|
|