From 5e6f76b796eecc3b76f8d9a4c3166edb4c916b85 Mon Sep 17 00:00:00 2001 From: Mark W <24956497+ndg63276@users.noreply.github.com> Date: Tue, 9 Dec 2025 10:28:57 +0000 Subject: [PATCH 1/6] LIMS-1275: Use streamed response for unzipped files (#1007) * LIMS-1275: Use streamed response for unzipped files * LIMS-1275: Ignore security advisories * Update api/composer.json Co-authored-by: Guilherme Francisco --------- Co-authored-by: Mark Williams Co-authored-by: Guilherme Francisco --- api/src/Page/Download.php | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/api/src/Page/Download.php b/api/src/Page/Download.php index df6ce88eb..328c8e783 100644 --- a/api/src/Page/Download.php +++ b/api/src/Page/Download.php @@ -247,7 +247,6 @@ function _get_autoproc_attachments() /** * Download a file to the browser * This function is used to download autoproc and phasing run attachments. - * It sets a maximum amount of memory for the download. * The $id is used as a prefix to the filename. * * @param integer $id One of AutoProcProgramId or PhasingProgramRunId @@ -255,8 +254,6 @@ function _get_autoproc_attachments() */ function _get_file($id, $file) { - // We don't want to allow unlimited file sizes - ini_set('memory_limit', '512M'); $filesystem = new Filesystem(); $filename = $file['FILEPATH'] . '/' . $file['FILENAME']; @@ -265,18 +262,28 @@ function _get_file($id, $file) if ($filesystem->exists($filename)) { $response = new BinaryFileResponse($filename); $this->set_mime_content($response, $filename, $id); - $response->headers->set("Content-Length", filesize($filename)); } elseif ($filesystem->exists($filename.'.gz')) { $filename = $filename.'.gz'; if ($this->has_arg('download') && $this->arg('download') < 3) { - // View/open file, so unzip and serve - $response = new Response(readgzfile($filename)); + // View log file, so unzip and serve + $response = new StreamedResponse(function() use ($filename) { + $fileHandle = gzopen($filename, 'rb'); + if ($fileHandle === false) { + $this->_error("The file " . $filename . " couldn't be opened"); + } + // Read the file in 8KB chunks and send them + while (!gzeof($fileHandle)) { + echo gzread($fileHandle, 8192); + if (ob_get_level()) ob_flush(); + flush(); + } + gzclose($fileHandle); + }); $this->set_mime_content($response, $file['FILENAME'], $id); } else { // Download gzipped file $response = new BinaryFileResponse($filename); $this->set_mime_content($response, $filename, $id); - $response->headers->set("Content-Length", filesize($filename)); } } else { $this->_error("No such file, the specified file " . $filename . " doesn't exist"); From f2e46fa4321dae3ba33ff461afcf706b8ef6c879 Mon Sep 17 00:00:00 2001 From: Mark W <24956497+ndg63276@users.noreply.github.com> Date: Tue, 9 Dec 2025 10:29:10 +0000 Subject: [PATCH 2/6] LIMS-1975: Fix 'View Upstream' button for LigandFit pipeline (#1011) Co-authored-by: Mark Williams --- api/src/Downstream/Type/LigandFit.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/api/src/Downstream/Type/LigandFit.php b/api/src/Downstream/Type/LigandFit.php index fb165959c..5f15a810f 100644 --- a/api/src/Downstream/Type/LigandFit.php +++ b/api/src/Downstream/Type/LigandFit.php @@ -56,6 +56,15 @@ function results() { $dat['MODEL_APPAID'] = $appaid; $dat['SOLUTIONS'] = json_decode($json_data); $dat['PARENTAUTOPROCPROGRAM'] = $this->process['PROCESSINGCOMMENTS']; + + $integrator = $this->_lookup_autoproc( + null, + $this->process['PARAMETERS']['scaling_id'] + ); + if ($integrator) { + $dat['PARENTAUTOPROCPROGRAM'] .= ' (' . $integrator['PROCESSINGPROGRAMS'] . ')'; + $dat['PARENTAUTOPROCPROGRAMID'] = $integrator['AUTOPROCPROGRAMID']; + } $results = new DownstreamResult($this); $results->data = $dat; From fa9224346c8835b63e8dae0300c324334e9c1d7c Mon Sep 17 00:00:00 2001 From: Mark W <24956497+ndg63276@users.noreply.github.com> Date: Tue, 9 Dec 2025 10:29:23 +0000 Subject: [PATCH 3/6] LIMS-1974: Indicate dev DB in header bar (#1012) * LIMS-1974: Indicate dev DB in header bar * LIMS-1974: Revert changes to config * LIMS-1974: Use a phase banner --------- Co-authored-by: Mark Williams --- api/config_sample.php | 2 +- api/index.php | 3 ++- client/src/js/app/components/breadcrumbs.vue | 8 +------- client/src/js/app/components/header.vue | 14 +++++++++++++- client/src/js/app/store/store.js | 2 ++ client/tailwind.config.js | 4 ++-- 6 files changed, 21 insertions(+), 12 deletions(-) diff --git a/api/config_sample.php b/api/config_sample.php index 4fb94bc03..6e4f7a2f0 100644 --- a/api/config_sample.php +++ b/api/config_sample.php @@ -10,7 +10,7 @@ $mode = 'dev'; # Database credentials, db = hostname/database - $isb = array('user' => 'user', 'pass' => 'pass', 'db' => 'localhost/ispyb'); + $isb = array('user' => 'user', 'pass' => 'pass', 'db' => 'localhost/ispyb'); $dbtype = 'mysql'; # Encoded JWT key, used to sign and check validaty of jwt tokens diff --git a/api/index.php b/api/index.php index a16c214de..286e85749 100644 --- a/api/index.php +++ b/api/index.php @@ -67,7 +67,7 @@ function setupApplication($mode): Slim }); $app->get('/options', function () use ($app) { - global $motd, $authentication_type, $cas_url, $cas_sso, $sso_url, $package_description, + global $mode, $motd, $authentication_type, $cas_url, $cas_sso, $sso_url, $package_description, $facility_courier_countries, $facility_courier_countries_nde, $facility_courier_countries_link, $icat_base_url, $visit_persist_storage_dir_segment, $dhl_enable, $scale_grid, $scale_grid_end_date, $preset_proposal, $timezone, $valid_components, $enabled_container_types, $synchweb_version, $redirects, @@ -78,6 +78,7 @@ function setupApplication($mode): Slim $app->contentType('application/json'); $options = $app->container['options']; $app->response()->body(json_encode(array( + 'mode' => $mode == 'production' ? 'production' : 'development', 'motd' => $options->get('motd', $motd), 'authentication_type' => $authentication_type, 'cas_url' => $cas_url, diff --git a/client/src/js/app/components/breadcrumbs.vue b/client/src/js/app/components/breadcrumbs.vue index b2f1f548a..5bacdd3f4 100644 --- a/client/src/js/app/components/breadcrumbs.vue +++ b/client/src/js/app/components/breadcrumbs.vue @@ -37,12 +37,6 @@ export default { \ No newline at end of file + diff --git a/client/src/js/app/components/header.vue b/client/src/js/app/components/header.vue index ac2758223..2f35f9028 100644 --- a/client/src/js/app/components/header.vue +++ b/client/src/js/app/components/header.vue @@ -1,4 +1,12 @@