3 function attendance_upgrade($oldversion) {
4 /// This function does anything necessary to upgrade
5 /// older versions to match current functionality
9 if ($oldversion < 2003091802) {
10 execute_sql("ALTER TABLE `{$CFG->prefix}attendance` ADD `edited` TINYINT( 1 ) DEFAULT '0' NOT NULL;");
11 execute_sql("UPDATE `{$CFG->prefix}attendance` set `edited` = 1;");
14 if ($oldversion < 2003092500) {
15 execute_sql("ALTER TABLE `{$CFG->prefix}attendance` ADD `autoattend` TINYINT( 1 ) DEFAULT '0' NOT NULL;");
18 if ($oldversion < 2004050301) {
19 modify_database("", "INSERT INTO {$CFG->prefix}log_display VALUES ('attendance', 'view', 'attendance', 'name');");
20 modify_database("", "INSERT INTO {$CFG->prefix}log_display VALUES ('attendance', 'viewall', 'attendance', 'name');");
21 modify_database("", "INSERT INTO {$CFG->prefix}log_display VALUES ('attendance', 'viewweek', 'attendance', 'name');");
24 if ($oldversion < 2004111200) {
25 execute_sql("ALTER TABLE {$CFG->prefix}attendance DROP INDEX course;",false);
26 execute_sql("ALTER TABLE {$CFG->prefix}attendance_roll DROP INDEX dayid;",false);
27 execute_sql("ALTER TABLE {$CFG->prefix}attendance_roll DROP INDEX userid;",false);
29 modify_database('','ALTER TABLE prefix_attendance ADD INDEX course (course);');
30 modify_database('','ALTER TABLE prefix_attendance_roll ADD INDEX dayid (dayid);');
31 modify_database('','ALTER TABLE prefix_attendance_roll ADD INDEX userid (userid);');