From: Vincent Vanwaelscappel Date: Thu, 7 Aug 2025 14:57:03 +0000 (+0200) Subject: wip #7684 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=dc41ad94a27728905e86c118d2234134ef987b48;p=fluidbook-toolbox.git wip #7684 --- diff --git a/app/Fluidbook/Farm.php b/app/Fluidbook/Farm.php index e19b2efaf..dabb0d4c8 100644 --- a/app/Fluidbook/Farm.php +++ b/app/Fluidbook/Farm.php @@ -309,6 +309,13 @@ class Farm protected static function _getFile($params, $attempts = 3, $checkOutput = true, $preferLocal = false) { $start = microtime(true); + + if ($params['operation'] === 'extractpdfarea') { + static::$_forceServer = 'amadeus'; + } else { + static::$_forceServer = false; + } + $farmer = self::pickOneServer($preferLocal, $params); $params['toolbox'] = '1'; @@ -403,14 +410,15 @@ class Farm public static function extractPDFArea($file, $page, $rect, $to = null, $options = array(), $cache = null) { - return static::lock($file, 'pdfarea_' . $file . '_' . $page . '_' . md5(json_encode($rect)) . '_' . md5(json_encode($options)), function () use ($file, $page, $rect, $to, $options, $cache) { + $lock = 'pdfarea_' . hash('sha256', $file . '_' . $page . '_' . json_encode($rect) . '_' . json_encode($options)); + return static::lock($file, $lock, function () use ($file, $page, $rect, $to, $options, $cache) { return self::_getFile( ['operation' => 'extractpdfarea', 'pdf' => $file, 'out' => $cache, - 'page' => $page, + 'page' => json_encode($rect), 'area' => $rect, - 'options' => $options], 0, false, true); + 'options' => json_encode($options)], 0, false, true); }); } }