Beispiel #1
0
function defaultOutput($tracking)
{
    $db = new AutotuneDb();
    $pos = $db->getQueuePosition($tracking);
    $details = array("tracking" => $tracking, "position" => $pos, "terminate" => $db->getTerminate($tracking), "runtime" => $db->getRuntime($tracking));
    $modelIds = $db->getModelIds($tracking);
    $models = array();
    foreach ($modelIds as $x => $value) {
        $models[$x] = array("id" => $value, "fitness" => $db->getFit($value));
    }
    return outputDetails($details, $models);
}
Beispiel #2
0
        } 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;
                        }
                    }
                }
                if (!isset($_REQUEST['models']) || !$validModels) {
                    $modelIds = $db->getModelIds($tracking);
                }
                //execute this if there are any models
                if ((int) count($modelIds) > 0) {
                    for ($i = 0; $i < count($modelIds); $i++) {
                        $file = $db->getFile($modelIds[$i]);
                        $zip->addFromString("tuned_{$modelIds[$i]}.idf", $file);
                    }
                    $zip->close();
                    $db->downloadFile($zipName);
                    unlink($zipName);
                }
            }
        }
    }
} else {