<?php include "redirect.php"; include "includes/header.php"; LangUtil::setPageId("reports"); $script_elems->enableDatePicker(); $script_elems->enableJQueryForm(); $script_elems->enableTableSorter(); db_get_current(); ?> <div class='reports_subdiv_help' id='reports_div_help' style='display:none'> <?php $tips_string = ""; $page_elems->getSideTip(LangUtil::$generalTerms['TIPS'], $tips_string); ?> </div> <div class='reports_subdiv_help' id='summary_div_help' style='display:none'> <?php $tips_string = LangUtil::$pageTerms['TIPS_INFECTIONSUMMARY']; $page_elems->getSideTip(LangUtil::$generalTerms['TIPS'], $tips_string); ?> </div> <div class='reports_subdiv_help' id='session_report_div_help2' style='display:none'> <?php $tips_string = LangUtil::$pageTerms['TIPS_SPECIMEN']; $page_elems->getSideTip(LangUtil::$generalTerms['TIPS'], $tips_string); ?> </div> <div class='reports_subdiv_help' id='pending_tests_div_help' style='display:none'> <?php $tips_string = LangUtil::$pageTerms['TIPS_PENDINGTESTS'];
$line = str_replace($dbname, $dbname . "_temp", $line); } } fwrite($fileWriteHandle, $line); } fclose($fileWriteHandle); fclose($fileHandle); $blisLabBackupTempFilePath = "\"" . $mainBlisDir . "\\htdocsxport\\blis_" . $lab_config_id . "_temp_backup.sql\""; $mysqlExePath = "\"" . $mainBlisDir . "server\\mysql\\bin\\mysql.exe\""; $dbTempName = "blis_" . $lab_config_id . "_temp"; $command = $mysqlExePath . " -h {$DB_HOST} -P 7188 -u {$DB_USER} -p{$DB_PASS} {$dbTempName} < {$blisLabBackupTempFilePath}"; $command = "C: &" . $command; //the C: is a useless command to prevent the original command from failing because of having more than 2 double quotes system($command, $return); unlink($backupLabDbTempFileName); $saved_db = db_get_current(); $switchDatabaseName = "blis_" . $lab_config_id . "_temp"; db_change($switchDatabaseName); $queryUpdate = "UPDATE patient " . "SET name = hash_value"; query_blind($queryUpdate); $backupLabDbTempFileName = "blis_" . $lab_config_id . "_temp_backup.sql"; $count = 0; $command = $mysqldumpPath . " -B -h {$DB_HOST} -P 7188 -u {$DB_USER} -p{$DB_PASS} {$dbTempName} > {$backupLabDbTempFileName}"; system($command); DbUtil::switchRestore($saved_db); $query = "DROP DATABASE " . $dbname . "_temp"; mysql_query($query, $con); $fileHandle = fopen($backupLabDbTempFileName, "r"); $backupLabDbFileName = "blis_" . $lab_config_id . "_backup.sql"; unlink($backupLabDbFileName); $fileWriteHandle = fopen($backupLabDbFileName, "w");
function query_blind($query) { global $con; $result = mysql_query($query, $con); //if($LOG_QUERIES == true) DebugLib::logQuery($query, db_get_current(), $_SESSION['username']); DebugLib::logDBUpdates($query, db_get_current()); return $result; }
public static function switchToLabConfigRevamp($lab_config_id = null) { $saved_db_name = db_get_current(); $lab_config = get_lab_config_by_id($lab_config_id); if ($lab_config == null) { # Error: Lab configuration correspinding to $lab_config_id not found in DB return; } $db_name = $lab_config->dbName; db_change($db_name); return $saved_db_name; }