From 959e404a72e8e537e74de994db439f53480a337c Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Tue, 22 Nov 2022 14:58:01 +0100 Subject: [PATCH] wait #5603 @1 --- app/Jobs/FluidbookCompiler.php | 3 ++- app/Models/FluidbookDocument.php | 8 ++++++-- app/Models/Traits/PublicationSettings.php | 4 ++-- config/logging.php | 4 ++-- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/app/Jobs/FluidbookCompiler.php b/app/Jobs/FluidbookCompiler.php index 02b9b58dc..e5302266b 100644 --- a/app/Jobs/FluidbookCompiler.php +++ b/app/Jobs/FluidbookCompiler.php @@ -334,7 +334,8 @@ class FluidbookCompiler extends Base implements CompilerInterface $this->imageFormat = $this->fluidbookSettings->imageFormat; - $imagesize = Image::getimagesize($this->getFluidbook()->getFile(1, $this->imageFormat, 150)); + $p1 = $this->getFluidbook()->getFile(1, $this->imageFormat, 150); + $imagesize = Image::getimagesize($p1); $this->pdf2htmlRatio = round(($imagesize[0] * 0.48) / $this->width, 12); $this->linkScale = $this->cssScale = $this->z * min($this->optimalWidth / $this->width, $this->optimalHeight / $this->height); diff --git a/app/Models/FluidbookDocument.php b/app/Models/FluidbookDocument.php index 3e855e553..442845c0f 100644 --- a/app/Models/FluidbookDocument.php +++ b/app/Models/FluidbookDocument.php @@ -17,7 +17,7 @@ use Illuminate\Support\Facades\Cache; class FluidbookDocument extends ToolboxModel { - public const WS_DOCS = '/data1/extranet/www/fluidbook/docs/'; + public const WS_DOCS = '/application/protected/fluidbook/docs/'; protected $table = 'fluidbook_document'; protected $_options = ['name' => 'fluidbook-document', 'singular' => 'document', @@ -302,9 +302,13 @@ class FluidbookDocument extends ToolboxModel } $doc = $this; - return Cache::tags('fluidbook_document_' . $this->id)->rememberForever($this->fileCacheKey($page, $format, $resolution, $withText, $withGraphics, $version), function () use ($doc, $page, $format, $resolution, $withText, $withGraphics, $version) { + $res = Cache::tags('fluidbook_document_' . $this->id)->rememberForever($this->fileCacheKey($page, $format, $resolution, $withText, $withGraphics, $version), function () use ($doc, $page, $format, $resolution, $withText, $withGraphics, $version) { return $doc->_getFile($page, $format, $resolution, $withText, $withGraphics, $version); }); + if (!$res && !$force) { + return $this->getFile($page, $format, $resolution, $withText, $withGraphics, $version, true); + } + return $res; } public function removeFile($page, $format = 'jpg', $resolution = 150, $withText = true, $withGraphics = true, $version = 'html') diff --git a/app/Models/Traits/PublicationSettings.php b/app/Models/Traits/PublicationSettings.php index 4193b0140..277382e28 100644 --- a/app/Models/Traits/PublicationSettings.php +++ b/app/Models/Traits/PublicationSettings.php @@ -1234,11 +1234,11 @@ trait PublicationSettings $this->addField('textExtraction', SelectFromArray::class, $this->__('Méthode d\'extraction des textes'), [ 'v2' => '{"type":"combo","default":"pdfbox","editable":true,"label":"\\u00a7!\\u00a7M\\u00e9thode d\'extraction des textes!\\u00a7!","datas":{"\\u00a7!\\u00a7PDFBox!\\u00a7!":"pdfbox","\\u00a7!\\u00a7Poppler!\\u00a7!":"poppler","\\u00a7!\\u00a7Fluidbook (exp\\u00e9rimentation bas\\u00e9e sur PDFBox)!\\u00a7!":"fluidbook"}}', 'options' => [ + 'fluidbook' => $this->__('Fluidbook (basée sur PDFBox)'), 'pdfbox' => $this->__('PDFBox'), 'poppler' => $this->__('Poppler'), - 'fluidbook' => $this->__('Fluidbook (expérimentation basée sur PDFBox)'), ], - 'default' => 'pdfbox', + 'default' => 'fluidbook', 'fake' => true, 'store_in' => 'settings', 'translatable' => false, diff --git a/config/logging.php b/config/logging.php index ddf84c02c..6ee2f9c54 100644 --- a/config/logging.php +++ b/config/logging.php @@ -37,7 +37,7 @@ return [ 'channels' => [ 'stack' => [ 'driver' => 'stack', - 'channels' => ['daily', 'stderr','slack'], + 'channels' => ['daily', 'stderr', 'slack'], 'ignore_exceptions' => false, ], @@ -59,7 +59,7 @@ return [ 'url' => env('LOG_SLACK_WEBHOOK_URL'), 'username' => 'Laravel Log', 'emoji' => ':boom:', - 'level' => 'critical', + 'level' => 'debug', ], 'papertrail' => [ -- 2.39.5