} if (version_compare($oldversion, '2.8', '<')) { updateInfo(-1, $langUpgCourse . " " . $row->code . " 2.8"); upgrade_course_2_8($row->code, $row->lang); } if (version_compare($oldversion, '2.9', '<')) { updateInfo(-1, $langUpgCourse . " " . $row->code . " 2.9"); upgrade_course_2_9($row->code, $row->lang); } if (version_compare($oldversion, '2.10', '<')) { updateInfo(-1, $langUpgCourse . " " . $row->code . " 2.10"); upgrade_course_2_10($row->code, $row->id); } if (version_compare($oldversion, '2.11', '<')) { updateInfo(-1, $langUpgCourse . " " . $row->code . " 2.10"); upgrade_course_2_11($row->code); } if (version_compare($oldversion, '3.0b2', '<')) { updateInfo(-1, $langUpgCourse . " " . $row->code . " 3.0"); upgrade_course_3_0($row->code, $row->id); } $i++; } if (version_compare($oldversion, '2.1.3', '<')) { updateInfo(0.98, $langChangeDBCharset . " " . $mysqlMainDb . " " . $langToUTF); convert_db_utf8($mysqlMainDb); } if (version_compare($oldversion, '3.0b2', '<')) { Database::get()->query("USE `{$mysqlMainDb}`"); Database::get()->query("CREATE VIEW `actions_daily_tmpview` AS\n SELECT\n `user_id`,\n `module_id`,\n `course_id`,\n COUNT(`id`) AS `hits`,\n SUM(`duration`) AS `duration`,\n DATE(`date_time`) AS `day`\n FROM `actions`\n GROUP BY DATE(`date_time`), `user_id`, `module_id`, `course_id`"); Database::get()->queryFunc("SELECT * FROM `actions_daily_tmpview`", function ($row) {
/** * @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(); }