$upgrade_ctl = new UpgradeController(); $migrations = $upgrade_ctl->getMigrationList($db_version); $install_dao = DAOFactory::getDAO('InstallerDAO'); foreach ($migrations as $migration) { print " Running migration " . $migration['version'] . "\n"; $install_dao->runMigrationSQL($migration['sql']); } $option_dao = DAOFactory::getDAO('OptionDAO'); $option = $option_dao->getOptionByName(OptionDAO::APP_OPTIONS, 'database_version'); if ($option) { $option_dao->updateOptionByName(OptionDAO::APP_OPTIONS, 'database_version', $thinkup_db_version); } else { $option_dao->insertOption(OptionDAO::APP_OPTIONS, 'database_version', $thinkup_db_version); } // release global mutex BackupController::mutexLock(); // delete upgrade token if it exists $upgrade_ctl->deleteTokenFile(); $upgrade_end_time = microtime(true); $total_time = $upgrade_end_time - $upgrade_start_time; print "\nUpgrade complete. Total time elapsed: " . round($total_time, 2) . " seconds\n\n"; } catch (Exception $e) { error_log(" Error: " . $e->getMessage() . "\n"); } function usage() { print "\n Usage:\n\n"; print " php upgrade.php [--help]\n\n"; print " --help - usage help\n\n"; exit; }