From 7f460113cc9c7eca91935549c25d78a9393e0977 Mon Sep 17 00:00:00 2001 From: Pjotr Date: Mon, 28 Sep 2026 14:48:57 +0000 Subject: container: deployment fixes for the Guix container/VM Changes previously carried as bnw-container-paths.patch in guix-bioinformatics, now applied to the source directly: * unify data directories on /var/lib/genenet/bnw (was /tmp/bnw and ./data/ mixed) * make the shell_exec paths __DIR__-relative and the example/octave helper scripts location-independent, so php-fpm can run them from any working directory * use core-octave randn/exp instead of the statistics-package normrnd/normpdf (not available in the container's octave) * nnodes: strtrim before strfind so the node count parses with the container's octave output * python3 instead of a hardcoded /home/jziebart path * add diag.php, a debug page showing the request and data state * bn_genenet.php: serve the GeneNetwork (GN2) handshake server-side; the My_Gennenet POST is converted (commas -> tabs, semicolons -> newlines) in PHP and the prepared-data page is returned in ONE request. This removes the raw-echo of into a JavaScript string (an XSS hole on public deployments) and is backward compatible for GN2 (same POST, better response). --- sourcecodes/graphviz_structure.php | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'sourcecodes/graphviz_structure.php') diff --git a/sourcecodes/graphviz_structure.php b/sourcecodes/graphviz_structure.php index 641a4854..34657436 100644 --- a/sourcecodes/graphviz_structure.php +++ b/sourcecodes/graphviz_structure.php @@ -23,10 +23,10 @@ $keyval=valid_keyval($_GET["My_key"]); /////////////////////////////////structure matrix////////////////////////////////////////////////////////// -//$matfile="./data/".$keyval."structure_input.txt"; -//$fout=fopen("./data/".$keyval."graphviz.txt","w"); -$matfile="/tmp/bnw/".$keyval."structure_input.txt"; -$fout=fopen("/tmp/bnw/".$keyval."graphviz.txt","w"); +//$matfile="/var/lib/genenet/bnw/".$keyval."structure_input.txt"; +//$fout=fopen("/var/lib/genenet/bnw/".$keyval."graphviz.txt","w"); +$matfile="/var/lib/genenet/bnw/".$keyval."structure_input.txt"; +$fout=fopen("/var/lib/genenet/bnw/".$keyval."graphviz.txt","w"); $matrix1=file_get_contents("$matfile"); $str_arrmat=array(); @@ -46,8 +46,8 @@ if ($fout !== false) { //fwrite($fouttemp,"$initialstring_temp"); -//$g_file_name="./data/".$keyval."grviz_name_file.txt"; -$g_file_name="/tmp/bnw/".$keyval."grviz_name_file.txt"; +//$g_file_name="/var/lib/genenet/bnw/".$keyval."grviz_name_file.txt"; +$g_file_name="/var/lib/genenet/bnw/".$keyval."grviz_name_file.txt"; $grviz_name_file=fopen($g_file_name,"w"); if ($grviz_name_file !== false) { @@ -90,10 +90,10 @@ if ($fout !== false) { //shell_exec('/usr/bin/dot -Tpng -o /var/www/html/compbio/BNW/graphviz.jpg /var/www/html/compbio/BNW/graphviztemp.txt'); -//$file1="./data/".$keyval."run_initialstructure.sh"; +//$file1="/var/lib/genenet/bnw/".$keyval."run_initialstructure.sh"; //$initiallines=file_get_contents("./data/temp_shell_file_initial_structure"); -$file1="/tmp/bnw/".$keyval."run_initialstructure.sh"; -$initiallines=file_get_contents("/tmp/bnw/temp_shell_file_initial_structure"); +$file1="/var/lib/genenet/bnw/".$keyval."run_initialstructure.sh"; +$initiallines=file_get_contents("/var/lib/genenet/bnw/temp_shell_file_initial_structure"); $all_lines="$initiallines"."$keyval\nfi\nexit"; $fp = fopen($file1,"w"); if ($fp !== false) { @@ -103,14 +103,14 @@ if ($fp !== false) { //prepare and execute shell script for matlab with a write lock //$cmd="./runmat.sh $keyval"; //system($cmd); -//$str_temp="./data/".$keyval."structure_input_temp.txt"; -//$str_temp="/tmp/bnw/".$keyval."structure_input_temp.txt"; +//$str_temp="/var/lib/genenet/bnw/".$keyval."structure_input_temp.txt"; +//$str_temp="/var/lib/genenet/bnw/".$keyval."structure_input_temp.txt"; //if (file_exists($str_temp)) { - shell_exec('./run_scripts/run_octave '.$keyval); + shell_exec(__DIR__.'/run_scripts/run_octave '.$keyval); //} else { // shell_exec('cp ./data/'.$keyval.'structure_input.txt ./data/'.$keyval.'structure_input_temp.txt'); -// shell_exec('cp /tmp/bnw/'.$keyval.'structure_input.txt /tmp/bnw/'.$keyval.'structure_input_temp.txt'); -// shell_exec('./run_scripts/run_octave '.$keyval); +// shell_exec('cp /var/lib/genenet/bnw/'.$keyval.'structure_input.txt /var/lib/genenet/bnw/'.$keyval.'structure_input_temp.txt'); +// shell_exec(__DIR__.'/run_scripts/run_octave '.$keyval); //} ?>