public function viewable(Silex\Application $app, $identifier) { $bucket = lmv::getDefaultBucket(); $lmv = new lmv($bucket); $urn = $lmv->getURN($identifier); if ($urn == '') { return new Response('', Response::HTTP_NOT_FOUND, ['Content-Type' => 'text/plain']); } $data = $lmv->all($urn); if ($data == null) { return new Response('', Response::HTTP_NOT_FOUND, ['Content-Type' => 'text/plain']); } if ($data->progress == 'complete') { $path = $app->dataDir("/{$identifier}.resultdb.json"); if (file_put_contents($path, json_encode($data)) === false) { utils::log("Could not save resultdb to disk! - {$path}"); } } return new JsonResponse($data, Response::HTTP_OK); }