@@ -372,7 +372,15 @@ public function installJava(?bool $async = false): void {
372372 throw new RuntimeException (sprintf ('OS_FAMILY %s is incompatible with LibreSign. ' , PHP_OS_FAMILY ));
373373 }
374374
375- if (!$ this ->isDownloadedFilesOk ()) {
375+ if ($ this ->isDownloadedFilesOk ()) {
376+ // The binaries files could exists but not saved at database
377+ if (!$ this ->appConfig ->getValueString (Application::APP_ID , 'java_path ' )) {
378+ $ linuxDistribution = $ this ->getLinuxDistributionToDownloadJava ();
379+ $ folder = $ this ->getFolder ('/ ' . $ linuxDistribution . '/ ' . $ this ->resource );
380+ $ extractDir = $ this ->getInternalPathOfFolder ($ folder );
381+ $ this ->appConfig ->setValueString (Application::APP_ID , 'java_path ' , $ extractDir . '/jdk- ' . self ::JAVA_URL_PATH_NAME . '-jre/bin/java ' );
382+ }
383+ } else {
376384 /**
377385 * Steps to update:
378386 * Check the compatible version of Java to use JSignPdf
@@ -458,7 +466,15 @@ public function installJSignPdf(?bool $async = false): void {
458466 return ;
459467 }
460468
461- if (!$ this ->isDownloadedFilesOk ()) {
469+ if ($ this ->isDownloadedFilesOk ()) {
470+ // The binaries files could exists but not saved at database
471+ if (!$ this ->appConfig ->getValueString (Application::APP_ID , 'jsignpdf_jar_path ' )) {
472+ $ folder = $ this ->getFolder ($ this ->resource );
473+ $ extractDir = $ this ->getInternalPathOfFolder ($ folder );
474+ $ fullPath = $ extractDir . '/jsignpdf- ' . JSignPdfHandler::VERSION . '/JSignPdf.jar ' ;
475+ $ this ->appConfig ->setValueString (Application::APP_ID , 'jsignpdf_jar_path ' , $ fullPath );
476+ }
477+ } else {
462478 $ folder = $ this ->getFolder ($ this ->resource );
463479 $ compressedFileName = 'jsignpdf- ' . JSignPdfHandler::VERSION . '.zip ' ;
464480 try {
@@ -506,7 +522,15 @@ public function installPdftk(?bool $async = false): void {
506522 return ;
507523 }
508524
509- if (!$ this ->isDownloadedFilesOk ()) {
525+ if ($ this ->isDownloadedFilesOk ()) {
526+ // The binaries files could exists but not saved at database
527+ if (!$ this ->appConfig ->getValueString (Application::APP_ID , 'pdftk_path ' )) {
528+ $ folder = $ this ->getFolder ($ this ->resource );
529+ $ file = $ folder ->getFile ('pdftk.jar ' );
530+ $ fullPath = $ this ->getInternalPathOfFile ($ file );
531+ $ this ->appConfig ->setValueString (Application::APP_ID , 'pdftk_path ' , $ fullPath );
532+ }
533+ } else {
510534 $ folder = $ this ->getFolder ($ this ->resource );
511535 try {
512536 $ file = $ folder ->getFile ('pdftk.jar ' );
@@ -560,6 +584,12 @@ public function installCfssl(?bool $async = false): void {
560584
561585 private function installCfsslByArchitecture (string $ architecture ): void {
562586 if ($ this ->isDownloadedFilesOk ()) {
587+ // The binaries files could exists but not saved at database
588+ if (!$ this ->isCfsslBinInstalled ()) {
589+ $ folder = $ this ->getFolder ($ this ->resource );
590+ $ cfsslBinPath = $ this ->getInternalPathOfFolder ($ folder ) . '/cfssl ' ;
591+ $ this ->appConfig ->setValueString (Application::APP_ID , 'cfssl_bin ' , $ cfsslBinPath );
592+ }
563593 return ;
564594 }
565595 $ folder = $ this ->getFolder ($ this ->resource );
0 commit comments