function fullOutput($tracking) { $db = new AutotuneDb(); $pos = $db->getQueuePosition($tracking); $weather = $db->getWeather($tracking); if ($weather == null) { $weather = ""; } $email = $db->getEmail($tracking); $inputFiles = $db->getInputFiles($tracking); $runtime = $db->getRuntime($tracking); $terminate = $db->getTerminate($tracking); $details = array("tracking" => $tracking, "position" => $pos, "weather" => $weather, "email" => $email, "baseModel" => $inputFiles['baseModel'], "parameters" => $inputFiles['parameters'], "schedule" => $inputFiles['schedule'], "userData" => $inputFiles['userData'], "terminate" => $terminate, "runtime" => $runtime); $modelIds = $db->getModelIds($tracking); $modelFile = array(); $models = array(); foreach ($modelIds as $x => $value) { $models[$x] = array("id" => $value, "fitness" => $db->getFit($value), "file" => $db->getFile($value)); } return outputDetails($details, $models); }
If models contains an invalid model, all models for the tracking will be provided instead. */ require 'dbAccess.php'; $db = new AutotuneDb(); if (isset($_REQUEST['tracking'])) { $tracking = $_REQUEST['tracking']; //check if tracking is valid if ($db->validTracking($tracking)) { // download a single model if (isset($_REQUEST['modelId']) && !isset($_REQUEST['models'])) { $modelId = $_REQUEST['modelId']; //check if model id is valid if ($db->validModelId($modelId)) { $fileName = "tuned_{$modelId}.idf"; $dir = "filesFolder"; file_put_contents("{$dir}/{$fileName}", $db->getFile($modelId)); $db->downloadFile("{$dir}/{$fileName}"); unlink("{$dir}/{$fileName}"); } } else { $zipName = $tracking . ".zip"; $zip = new zipArchive(); if ($zip->open($zipName, ZIPARCHIVE::CREATE)) { $validModels = true; if (isset($_REQUEST['models'])) { $modelIds = $_REQUEST['models']; //validate foreach ($modelIds as $modelId) { if (!$db->validModelId($modelId)) { $validModels = false; }