diff --git a/bin/fileconvert.php b/bin/fileconvert.php index 37184b8..00cea74 100755 --- a/bin/fileconvert.php +++ b/bin/fileconvert.php @@ -2,7 +2,15 @@ include("config/app-config.php"); -$args = "bin/DocumentConverter.py \"".$argv[1]."\" \"".$argv[2]."\" 1>".TMP_DIR."/doc_conv.out 2>".TMP_DIR."/doc_conv.err"; +# Get host & port that OOo is running at if available +$sysconf = "/etc/sysconfig/docmgr"; +$oourl = `if [ -r "$sysconf" ]; then + . $sysconf + [ -n "\$OOFFICE_HOST" ] && echo -n "-h \$OOFFICE_HOST " + [ -n "\$OOFFICE_PORT" ] && echo -n "-p \$OOFFICE_PORT " + fi`; + +$args = "DocumentConverter $oourl \"".$argv[1]."\" \"".$argv[2]."\" 1>".TMP_DIR."/doc_conv.out 2>".TMP_DIR."/doc_conv.err"; if (file_exists(OPENOFFICE_PATH."/program/python")) $cmd = OPENOFFICE_PATH."/program/python ".$args; # Try see if the directory where we expect the python module to be located exists, @@ -12,15 +20,8 @@ else if (file_exists(OPENOFFICE_PATH."/basis-link/program")) # Execute a shell to have all profile scripts loaded which is where most # distributions adds OOo to $PYTHONPATH through else - $cmd = "sh --login -c 'python ".$args."'"; + $cmd = "sh --login -c '$args:"; -# Get host & port that OOo is running at if available -$sysconf = "/etc/sysconfig/docmgr"; -$ooenv = `if [ -r "$sysconf" ]; then - . $sysconf - [ -n "\$OOFFICE_HOST" ] && echo -n "OOFFICE_HOST=\$OOFFICE_HOST " - [ -n "\$OOFFICE_PORT" ] && echo -n "OOFFICE_PORT=\$OOFFICE_PORT " - fi`; -$res = `$ooenv $cmd`; +$res = `$cmd`; echo $res."\n";