@@ -363,44 +363,44 @@ public function installJava(?bool $async = false): void {
363363 $ extractDir = $ this ->getInternalPathOfFolder ($ folder );
364364 $ this ->appConfig ->setValueString (Application::APP_ID , 'java_path ' , $ extractDir . '/jdk- ' . self ::JAVA_URL_PATH_NAME . '-jre/bin/java ' );
365365 }
366- } else {
367- /**
368- * Steps to update:
369- * Check the compatible version of Java to use JSignPdf
370- * Update all the follow data
371- * Update the constants with java version
372- * URL used to get the MD5 and URL to download:
373- * https://jdk.java.net/java-se-ri/8-MR3
374- */
375- $ linuxDistribution = $ this ->getLinuxDistributionToDownloadJava ();
376- $ slugfyVersionNumber = str_replace ('+ ' , '_ ' , self ::JAVA_URL_PATH_NAME );
377- if ($ this ->architecture === 'x86_64 ' ) {
378- $ compressedFileName = 'OpenJDK21U-jre_x64_ ' . $ linuxDistribution . '_hotspot_ ' . $ slugfyVersionNumber . '.tar.gz ' ;
379- $ url = 'https://github.com/adoptium/temurin21-binaries/releases/download/jdk- ' . self ::JAVA_URL_PATH_NAME . '/ ' . $ compressedFileName ;
380- } elseif ($ this ->architecture === 'aarch64 ' ) {
381- $ compressedFileName = 'OpenJDK21U-jre_aarch64_ ' . $ linuxDistribution . '_hotspot_ ' . $ slugfyVersionNumber . '.tar.gz ' ;
382- $ url = 'https://github.com/adoptium/temurin21-binaries/releases/download/jdk- ' . self ::JAVA_URL_PATH_NAME . '/ ' . $ compressedFileName ;
383- }
384- $ folder = $ this ->getFolder ('/ ' . $ linuxDistribution . '/ ' . $ this ->resource );
385- try {
386- $ compressedFile = $ folder ->getFile ($ compressedFileName );
387- } catch (NotFoundException $ th ) {
388- $ compressedFile = $ folder ->newFile ($ compressedFileName );
389- }
366+ return ;
367+ }
368+ /**
369+ * Steps to update:
370+ * Check the compatible version of Java to use JSignPdf
371+ * Update all the follow data
372+ * Update the constants with java version
373+ * URL used to get the MD5 and URL to download:
374+ * https://jdk.java.net/java-se-ri/8-MR3
375+ */
376+ $ linuxDistribution = $ this ->getLinuxDistributionToDownloadJava ();
377+ $ slugfyVersionNumber = str_replace ('+ ' , '_ ' , self ::JAVA_URL_PATH_NAME );
378+ if ($ this ->architecture === 'x86_64 ' ) {
379+ $ compressedFileName = 'OpenJDK21U-jre_x64_ ' . $ linuxDistribution . '_hotspot_ ' . $ slugfyVersionNumber . '.tar.gz ' ;
380+ $ url = 'https://github.com/adoptium/temurin21-binaries/releases/download/jdk- ' . self ::JAVA_URL_PATH_NAME . '/ ' . $ compressedFileName ;
381+ } elseif ($ this ->architecture === 'aarch64 ' ) {
382+ $ compressedFileName = 'OpenJDK21U-jre_aarch64_ ' . $ linuxDistribution . '_hotspot_ ' . $ slugfyVersionNumber . '.tar.gz ' ;
383+ $ url = 'https://github.com/adoptium/temurin21-binaries/releases/download/jdk- ' . self ::JAVA_URL_PATH_NAME . '/ ' . $ compressedFileName ;
384+ }
385+ $ folder = $ this ->getFolder ('/ ' . $ linuxDistribution . '/ ' . $ this ->resource );
386+ try {
387+ $ compressedFile = $ folder ->getFile ($ compressedFileName );
388+ } catch (NotFoundException $ th ) {
389+ $ compressedFile = $ folder ->newFile ($ compressedFileName );
390+ }
390391
391- $ compressedInternalFileName = $ this ->getInternalPathOfFile ($ compressedFile );
392- $ dependencyName = 'java ' . $ this ->architecture . ' ' . $ linuxDistribution ;
393- $ checksumUrl = $ url . '.sha256.txt ' ;
394- $ hash = $ this ->getHash ($ compressedFileName , $ checksumUrl );
395- $ this ->download ($ url , $ dependencyName , $ compressedInternalFileName , $ hash , 'sha256 ' );
392+ $ compressedInternalFileName = $ this ->getInternalPathOfFile ($ compressedFile );
393+ $ dependencyName = 'java ' . $ this ->architecture . ' ' . $ linuxDistribution ;
394+ $ checksumUrl = $ url . '.sha256.txt ' ;
395+ $ hash = $ this ->getHash ($ compressedFileName , $ checksumUrl );
396+ $ this ->download ($ url , $ dependencyName , $ compressedInternalFileName , $ hash , 'sha256 ' );
396397
397- $ extractor = new TAR ($ compressedInternalFileName );
398- $ extractDir = $ this ->getInternalPathOfFolder ($ folder );
399- $ extractor ->extract ($ extractDir );
400- unlink ($ compressedInternalFileName );
401- $ this ->appConfig ->setValueString (Application::APP_ID , 'java_path ' , $ extractDir . '/jdk- ' . self ::JAVA_URL_PATH_NAME . '-jre/bin/java ' );
402- $ this ->writeAppSignature ();
403- }
398+ $ extractor = new TAR ($ compressedInternalFileName );
399+ $ extractDir = $ this ->getInternalPathOfFolder ($ folder );
400+ $ extractor ->extract ($ extractDir );
401+ unlink ($ compressedInternalFileName );
402+ $ this ->appConfig ->setValueString (Application::APP_ID , 'java_path ' , $ extractDir . '/jdk- ' . self ::JAVA_URL_PATH_NAME . '-jre/bin/java ' );
403+ $ this ->writeAppSignature ();
404404 $ this ->removeDownloadProgress ();
405405 }
406406
@@ -457,27 +457,27 @@ public function installJSignPdf(?bool $async = false): void {
457457 $ fullPath = $ extractDir . '/jsignpdf- ' . InstallService::JSIGNPDF_VERSION . '/JSignPdf.jar ' ;
458458 $ this ->appConfig ->setValueString (Application::APP_ID , 'jsignpdf_jar_path ' , $ fullPath );
459459 }
460- } else {
461- $ folder = $ this ->getFolder ($ this ->resource );
462- $ compressedFileName = 'jsignpdf- ' . InstallService::JSIGNPDF_VERSION . '.zip ' ;
463- try {
464- $ compressedFile = $ folder ->getFile ($ compressedFileName );
465- } catch (\Throwable $ th ) {
466- $ compressedFile = $ folder ->newFile ($ compressedFileName );
467- }
468- $ compressedInternalFileName = $ this ->getInternalPathOfFile ($ compressedFile );
469- $ url = 'https://github.com/intoolswetrust/jsignpdf/releases/download/JSignPdf_ ' . str_replace ('. ' , '_ ' , InstallService::JSIGNPDF_VERSION ) . '/jsignpdf- ' . InstallService::JSIGNPDF_VERSION . '.zip ' ;
460+ return ;
461+ }
462+ $ folder = $ this ->getFolder ($ this ->resource );
463+ $ compressedFileName = 'jsignpdf- ' . InstallService::JSIGNPDF_VERSION . '.zip ' ;
464+ try {
465+ $ compressedFile = $ folder ->getFile ($ compressedFileName );
466+ } catch (\Throwable $ th ) {
467+ $ compressedFile = $ folder ->newFile ($ compressedFileName );
468+ }
469+ $ compressedInternalFileName = $ this ->getInternalPathOfFile ($ compressedFile );
470+ $ url = 'https://github.com/intoolswetrust/jsignpdf/releases/download/JSignPdf_ ' . str_replace ('. ' , '_ ' , InstallService::JSIGNPDF_VERSION ) . '/jsignpdf- ' . InstallService::JSIGNPDF_VERSION . '.zip ' ;
470471
471- $ this ->download ($ url , 'JSignPdf ' , $ compressedInternalFileName , self ::JSIGNPDF_HASH );
472+ $ this ->download ($ url , 'JSignPdf ' , $ compressedInternalFileName , self ::JSIGNPDF_HASH );
472473
473- $ extractDir = $ this ->getInternalPathOfFolder ($ folder );
474- $ zip = new ZIP ($ extractDir . '/ ' . $ compressedFileName );
475- $ zip ->extract ($ extractDir );
476- unlink ($ extractDir . '/ ' . $ compressedFileName );
477- $ fullPath = $ extractDir . '/jsignpdf- ' . InstallService::JSIGNPDF_VERSION . '/JSignPdf.jar ' ;
478- $ this ->appConfig ->setValueString (Application::APP_ID , 'jsignpdf_jar_path ' , $ fullPath );
479- $ this ->writeAppSignature ();
480- }
474+ $ extractDir = $ this ->getInternalPathOfFolder ($ folder );
475+ $ zip = new ZIP ($ extractDir . '/ ' . $ compressedFileName );
476+ $ zip ->extract ($ extractDir );
477+ unlink ($ extractDir . '/ ' . $ compressedFileName );
478+ $ fullPath = $ extractDir . '/jsignpdf- ' . InstallService::JSIGNPDF_VERSION . '/JSignPdf.jar ' ;
479+ $ this ->appConfig ->setValueString (Application::APP_ID , 'jsignpdf_jar_path ' , $ fullPath );
480+ $ this ->writeAppSignature ();
481481
482482 $ this ->removeDownloadProgress ();
483483 }
@@ -511,20 +511,20 @@ public function installPdftk(?bool $async = false): void {
511511 $ fullPath = $ this ->getInternalPathOfFile ($ file );
512512 $ this ->appConfig ->setValueString (Application::APP_ID , 'pdftk_path ' , $ fullPath );
513513 }
514- } else {
515- $ folder = $ this ->getFolder ($ this ->resource );
516- try {
517- $ file = $ folder ->getFile ('pdftk.jar ' );
518- } catch (\Throwable $ th ) {
519- $ file = $ folder ->newFile ('pdftk.jar ' );
520- }
521- $ fullPath = $ this ->getInternalPathOfFile ($ file );
522- $ url = 'https://gitlab.com/api/v4/projects/5024297/packages/generic/pdftk-java/v ' . self ::PDFTK_VERSION . '/pdftk-all.jar ' ;
523-
524- $ this ->download ($ url , 'pdftk ' , $ fullPath , self ::PDFTK_HASH );
525- $ this ->appConfig ->setValueString (Application::APP_ID , 'pdftk_path ' , $ fullPath );
526- $ this ->writeAppSignature ();
514+ return ;
515+ }
516+ $ folder = $ this ->getFolder ($ this ->resource );
517+ try {
518+ $ file = $ folder ->getFile ('pdftk.jar ' );
519+ } catch (\Throwable $ th ) {
520+ $ file = $ folder ->newFile ('pdftk.jar ' );
527521 }
522+ $ fullPath = $ this ->getInternalPathOfFile ($ file );
523+ $ url = 'https://gitlab.com/api/v4/projects/5024297/packages/generic/pdftk-java/v ' . self ::PDFTK_VERSION . '/pdftk-all.jar ' ;
524+
525+ $ this ->download ($ url , 'pdftk ' , $ fullPath , self ::PDFTK_HASH );
526+ $ this ->appConfig ->setValueString (Application::APP_ID , 'pdftk_path ' , $ fullPath );
527+ $ this ->writeAppSignature ();
528528 $ this ->removeDownloadProgress ();
529529 }
530530
0 commit comments