DBHelper::indexExists('unit_resources', 'unit_res_visible') or Database::get()->query("CREATE INDEX `unit_res_visible` ON unit_resources (visible)"); DBHelper::indexExists('unit_resources', 'unit_res_res_id') or Database::get()->query("CREATE INDEX `unit_res_res_id` ON unit_resources (res_id)"); DBHelper::indexExists('personal_calendar', 'pcal_start') or Database::get()->query('CREATE INDEX `pcal_start` ON personal_calendar (start)'); DBHelper::indexExists('agenda', 'agenda_start') or Database::get()->query('CREATE INDEX `agenda_start` ON agenda (start)'); DBHelper::indexExists('assignment', 'assignment_deadline') or Database::get()->query('CREATE INDEX `assignment_deadline` ON assignment (deadline)'); // ********************************************** // upgrade courses databases // ********************************************** $res = Database::get()->queryArray("SELECT id, code, lang FROM course ORDER BY code"); $total = count($res); $i = 1; foreach ($res as $row) { updateInfo($i / ($total + 1), $langUpgCourse); if (version_compare($oldversion, '2.2', '<')) { updateInfo(-1, $langUpgCourse . " " . $row->code . " 2.2"); upgrade_course_2_2($row->code, $row->lang); } if (version_compare($oldversion, '2.3', '<')) { updateInfo(-1, $langUpgCourse . " " . $row->code . " 2.3"); upgrade_course_2_3($row->code); } if (version_compare($oldversion, '2.4', '<')) { updateInfo(-1, $langUpgCourse . " " . $row->code . " 2.4"); upgrade_course_index_php($row->code); upgrade_course_2_4($row->code, $row->id, $row->lang); } if (version_compare($oldversion, '2.5', '<')) { updateInfo(-1, $langUpgCourse . " " . $row->code . " 2.5"); upgrade_course_2_5($row->code, $row->lang); } if (version_compare($oldversion, '2.8', '<')) {
/** * @brief Upgrade course database * @param type $code * @param type $lang */ function upgrade_course($code, $lang) { upgrade_course_2_1_3($code); upgrade_course_2_2($code, $lang); upgrade_course_2_3($code); upgrade_course_2_4($code, $lang); upgrade_course_2_5($code, $lang); upgrade_course_2_8($code, $lang); upgrade_course_2_9($code, $lang); upgrade_course_2_10($code); upgrade_course_2_11($code); upgrade_course_3_0($code); Database::forget(); }