function retune($tracking) { $db = new AutotuneDb(); if (!$db->validTracking($tracking)) { // return error for invalid tracking return outputError("1005"); } $newTracking = $db->duplicate($tracking); $pos = $db->getQueuePosition($newTracking); return outputNewTracking($newTracking, $pos); }
Input Required -> tracking, models Output Zip file Name = "[tracking].zip" Contents = all models named as "tuned_[modelId].idf" If modelId and models are both included, models will be used by default and modelId will be ignored. 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)) {