$extra_json = json_encode($extra); $sql2 = "UPDATE questions SET display_method = '', settings = ? WHERE q_id = ?"; $area_upd = $mysqli->prepare($sql2); $area_upd->bind_param('si', $extra_json, $q_id); $area_upd->execute(); $area_upd->close(); $count++; } $area_qs->close(); if ($count > 0) { echo '<li>Updated TEXTBOX questions</li>'; } echo '</ul></li>'; } // 17/05/2013 (brzsw) - Add cache_paper_stats table if (!$updater_utils->does_table_exist('cache_paper_stats')) { $sql = "CREATE TABLE cache_paper_stats (paperID mediumint(8) unsigned not null, cached int unsigned, max_mark decimal(10,5), max_percent decimal(10,5), min_mark decimal(10,5), min_percent decimal(10,5), q1 decimal(10,5), q2 decimal(10,5), q3 decimal(10,5), mean_mark decimal(10,5), mean_percent decimal(10,5), stdev_mark decimal(10,5), stdev_percent decimal(10,5), UNIQUE KEY `paperID` (`paperID`)) ENGINE=InnoDB"; $updater_utils->execute_query($sql, true); $sql = 'GRANT SELECT, INSERT, UPDATE, DELETE ON ' . $cfg_db_database . '.cache_paper_stats TO \'' . $cfg_db_staff_user . '\'@\'' . $cfg_web_host . '\''; $updater_utils->execute_query($sql, true); $sql = 'GRANT SELECT ON ' . $cfg_db_database . '.cache_paper_stats TO \'' . $cfg_db_student_user . '\'@\'' . $cfg_web_host . '\''; $updater_utils->execute_query($sql, true); } if (!$updater_utils->has_grant($cfg_db_external_user, 'SELECT', 'cache_paper_stats', $cfg_web_host)) { $sql = 'GRANT SELECT ON ' . $cfg_db_database . '.cache_paper_stats TO \'' . $cfg_db_external_user . '\'@\'' . $cfg_web_host . '\''; $updater_utils->execute_query($sql, true); } // 20/05/2013 (brzsw) - Add cache_student_paper_marks table if (!$updater_utils->does_table_exist('cache_student_paper_marks')) { $sql = "CREATE TABLE cache_student_paper_marks (paperID mediumint(8) unsigned not null, userID int(10) unsigned, mark decimal(10,5), percent decimal(10,5)) ENGINE=InnoDB"; $updater_utils->execute_query($sql, true);
$sql = "GRANT SELECT, INSERT, UPDATE ON " . $cfg_db_database . ".log6 TO '" . $cfg_db_student_user . "'@'" . $cfg_db_host . "'"; $updater_utils->execute_query($sql, true); $sql = "GRANT SELECT, INSERT, UPDATE ON " . $cfg_db_database . ".log6 TO '" . $cfg_db_staff_user . "'@'" . $cfg_db_host . "'"; $updater_utils->execute_query($sql, true); } $mysqli->commit(); // 08/09/2011 - Add auth_user column to sys_errors if (!$updater_utils->does_column_exist('sys_errors', 'auth_user')) { $updater_utils->execute_query("ALTER TABLE sys_errors ADD COLUMN auth_user VARCHAR(45) DEFAULT NULL AFTER userID", true); } // 13/01/2012 - Add deleted column to Faculty table if (!$updater_utils->does_column_exist('faculty', 'deleted')) { $updater_utils->execute_query("ALTER TABLE faculty ADD COLUMN deleted datetime", true); } // 13/01/2012 - Add deleted column to Degrees table if ($updater_utils->does_table_exist('degrees')) { if (!$updater_utils->does_column_exist('degrees', 'deleted')) { $updater_utils->execute_query("ALTER TABLE degrees ADD COLUMN deleted datetime", true); } } // 13/01/2012 - Add new character set to configuration file. $new_cfg_str[] = " \$cfg_db_charset = 'latin1';\n"; $cfg = file($cfg_web_root . 'config/config.inc.php'); //remove refrances to old vars $cfg_new = array(); $found = false; foreach ($cfg as $line) { if (strpos($line, 'cfg_db_charset') !== false) { $found = true; } $cfg_new[] = $line;