]> _ Git - cubeextranet.git/commitdiff
wait #5716 @1
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 7 Feb 2023 14:33:35 +0000 (14:33 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 7 Feb 2023 14:33:35 +0000 (14:33 +0000)
inc/ws/Controlleur/class.ws.flash.php
inc/ws/Metier/class.ws.document.php

index e01336eb81e96c924c1c778f2cb0c037f6672f7e..f870ece193eca41023ca7e4935afee2a97017e09 100644 (file)
@@ -345,6 +345,7 @@ class wsFlash extends cubeFlashGateway
     public function getPagesOfBook()
     {
         global $core;
+        set_time_limit(0);
 
         $this->json = true;
 
@@ -357,8 +358,8 @@ class wsFlash extends cubeFlashGateway
         foreach ($pages as $page => $info) {
             //$book->getFile($page, 'swf', 150);
             $book->getFile($page, 'jpg', 150, true, true, 'html');
-            $book->getFile($page, 'jpg', 'thumb');
-            $file = WS_DOCS . '/' . $info['document_id'] . '/p' . $info['document_page'] . '.jpg';
+            $file=$book->getFile($page, 'jpg', 'thumb');
+            //$file = WS_DOCS . '/' . $info['document_id'] . '/p' . $info['document_page'] . '.jpg';
             if (!file_exists($file)) {
                 $info['resolution'] = 150;
                 $info['method'] = 1;
@@ -388,7 +389,7 @@ class wsFlash extends cubeFlashGateway
         } else {
             $this->jsonDatas['numerotation'] = explode(',', $book->numerotation);
         }
-        error_log(json_encode($this->jsonDatas));
+        //error_log(json_encode($this->jsonDatas));
     }
 
     public function getTheme()
index aea4e34cd23b7c8ae845f493cea24f403147021f..c961c6b9f1b858febfa648a800257ca0dbbe3b70 100644 (file)
@@ -472,7 +472,7 @@ class wsDocument extends cubeMetier
         return self::$_farmServers[$i];
     }
 
-    public static function getFCGIConnexion(array $farm, $timeout = 30): NetworkSocket
+    public static function getFCGIConnexion(array $farm, $timeout = 120): NetworkSocket
     {
         $timeout *= 1000;
         return new NetworkSocket(
@@ -483,7 +483,7 @@ class wsDocument extends cubeMetier
         );
     }
 
-    public static function sendRequest($farmer, $url, $params = [], $timeout = 30)
+    public static function sendRequest($farmer, $url, $params = [], $timeout = 120)
     {
         $client = new Client();
         $response = $client->sendRequest(self::getFCGIConnexion($farmer, $timeout), new PostRequest($url, http_build_query($params)));
@@ -496,19 +496,25 @@ class wsDocument extends cubeMetier
         $farmer = self::pickOneFarmServer();
 
         $params = ['page' => $page, 'format' => $format, 'resolution' => $resolution, 'withText' => $withText, 'withGraphics' => $withGraphics, 'version' => $version, 'force' => $force, 'out' => $this->out, 'resolutionRatio' => $this->getResolutionRatio(), 'mobileRatio' => $this->getMobileFirstRatio()];
-        $output = self::sendRequest($farmer, 'process.php', $params);
-        if (preg_match('|/data1/extranet/www/[^\s]+|', $output, $matches)) {
-            $o = $matches[0];
-        } else {
-            $o = $output;
-        }
-        $o = str_replace('/data1/extranet/www/', '/application/', $o);
-        if (file_exists($o)) {
-            $res = $o;
-        } else {
-            echo $output;
+        try {
+            $output = self::sendRequest($farmer, 'process.php', $params);
+            if (preg_match('|/data1/extranet/www/[^\s]+|', $output, $matches)) {
+                $o = $matches[0];
+            } else {
+                $o = $output;
+            }
+            $o = str_replace('/data1/extranet/www/', '/application/', $o);
+            if (file_exists($o)) {
+                $res = $o;
+            } else {
+                echo $output;
+                $res = false;
+            }
+        } catch (Exception $e) {
+            $output = 'error : on page ' . json_encode($params) . ' : ' . $e->getMessage();
             $res = false;
         }
+
         $time = round(microtime(true) - $start, 4);
         $log = '[' . $farmer['name'] . ']' . "\t" . date('Y-m-d H:i:s') . "\t\t\t\t" . $time . "\t\t\t\t$page|$format|$resolution|$withText|$withGraphics|$version\t\t\t\t$res\t\t\t\t$output\n";