function checkForUpdates() { global $UPDATES_PATH, $dbh; // Check for update scripts $content = file_get_contents("{$UPDATES_PATH}/modules.json"); $jsonModules = json_decode($content, true); foreach ($jsonModules as $name => $version) { $installedVersion = getVersionForModule($dbh, $name); if ($installedVersion < $version) { log_update("Module {$name}: latest version is {$version}, current version is {$installedVersion}"); for ($i = $installedVersion + 1; $i <= $version; $i++) { runUpdate($name, $i); } flagInstalled($name, $version); } else { log_update("Module {$name}: latest version already installed ({$installedVersion})"); } } }
# Called after htdocs update succeeds # include "redirect.php"; include "../includes/db_lib.php"; include "../includes/user_lib.php"; $user = get_user_by_id($_SESSION['user_id']); if (is_super_admin($user) || is_country_dir($user)) { $labConfigList = get_lab_configs($user->userId); foreach ($labConfigList as $labConfig) { $labConfigId = $labConfig->id; runUpdate($labConfigId); } //runGlobalUpdate(); } else { $labConfigId = $_SESSION['lab_config_id']; runUpdate($labConfigId); //runGlobalUpdate(); } function runUpdate($lab_config_id) { global $con; /*BLIS 1.26 Update $saved_db = DbUtil::switchToLabConfig($lab_config_id); $query_alter = "ALTER TABLE report_disease ". "DROP FOREIGN KEY report_disease_ibfk_1"; mysql_query( $query_alter, $con ) or die(mysql_error()); /*BLIS 1.27 Update $query_alter = "ALTER TABLE stock_details ADD COLUMN used VARCHAR(1000) NULL DEFAULT '' ". "AFTER quantity_used , ADD COLUMN user VARCHAR(1000) NULL DEFAULT '' AFTER used ,".
<h4><a href="?p=admin">Main Menu</a> / Updates</h4> </div> <!-- .content-header --> <div class="main-content"> <table width="100%"> <thead> <th><center>Update Info</center></th> </thead> </table> <br /> <table> <tr> <?php if (isset($_GET['update'])) { if ($_GET['update'] == 'db') { runDatabaseSql(); } } else { if (isset($_POST['action'])) { if ($_POST['action'] == 'update') { runUpdate(); } } else { checkUpdates(); } } ?> </tr> </table> </div> </div>