Skip to content

Commit c393913

Browse files
committed
refactor: moved hashes to be close to version number
This will make more easy when we need to update the version of dependencies. Signed-off-by: Vitor Mattos <vitor@php.rio>
1 parent caf78eb commit c393913

1 file changed

Lines changed: 7 additions & 11 deletions

File tree

lib/Service/Install/InstallService.php

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@
4141
class InstallService {
4242
public const JAVA_VERSION = 'openjdk version "21.0.6" 2025-01-21 LTS';
4343
private const JAVA_URL_PATH_NAME = '21.0.6+7';
44-
public const PDFTK_VERSION = '3.3.3';
45-
public const JSIGNPDF_VERSION = '2.3.0';
46-
/**
47-
* When update, verify the hash of all architectures
48-
*/
44+
public const PDFTK_VERSION = '3.3.3'; /** @todo When update, verify the hash **/
45+
private const PDFTK_HASH = '59a28bed53b428595d165d52988bf4cf';
46+
public const JSIGNPDF_VERSION = '2.3.0'; /** @todo When update, verify the hash **/
47+
private const JSIGNPDF_HASH = 'd239658ea50a39eb35169d8392feaffb';
4948
public const CFSSL_VERSION = '1.6.5';
49+
5050
private ICache $cache;
5151
private ?OutputInterface $output = null;
5252
private string $resource = '';
@@ -484,10 +484,8 @@ public function installJSignPdf(?bool $async = false): void {
484484
}
485485
$comporessedInternalFileName = $this->getInternalPathOfFile($compressedFile);
486486
$url = 'https://github.com/intoolswetrust/jsignpdf/releases/download/JSignPdf_' . str_replace('.', '_', InstallService::JSIGNPDF_VERSION) . '/jsignpdf-' . InstallService::JSIGNPDF_VERSION . '.zip';
487-
/** WHEN UPDATE version: generate this hash handmade and update here */
488-
$hash = 'd239658ea50a39eb35169d8392feaffb';
489487

490-
$this->download($url, 'JSignPdf', $comporessedInternalFileName, $hash);
488+
$this->download($url, 'JSignPdf', $comporessedInternalFileName, self::JSIGNPDF_HASH);
491489

492490
$extractDir = $this->getInternalPathOfFolder($folder);
493491
$zip = new ZIP($extractDir . '/' . $compressedFileName);
@@ -539,10 +537,8 @@ public function installPdftk(?bool $async = false): void {
539537
}
540538
$fullPath = $this->getInternalPathOfFile($file);
541539
$url = 'https://gitlab.com/api/v4/projects/5024297/packages/generic/pdftk-java/v' . self::PDFTK_VERSION . '/pdftk-all.jar';
542-
/** @todo WHEN UPDATE version: generate this hash handmade and update here */
543-
$hash = '59a28bed53b428595d165d52988bf4cf';
544540

545-
$this->download($url, 'pdftk', $fullPath, $hash);
541+
$this->download($url, 'pdftk', $fullPath, self::PDFTK_HASH);
546542
$this->appConfig->setValueString(Application::APP_ID, 'pdftk_path', $fullPath);
547543
$this->writeAppSignature();
548544
}

0 commit comments

Comments
 (0)