From 9c54c2b2908d818f4fcf0632680a992a9a114eb4 Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Thu, 7 Apr 2022 20:04:24 +0000 Subject: [PATCH] wip #5220 @0.5 --- inc/ws/Controlleur/class.ws.maintenance.php | 13 +++++++++++++ inc/ws/Metier/class.ws.document.php | 20 ++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/inc/ws/Controlleur/class.ws.maintenance.php b/inc/ws/Controlleur/class.ws.maintenance.php index c238fdbd0..29796cde4 100644 --- a/inc/ws/Controlleur/class.ws.maintenance.php +++ b/inc/ws/Controlleur/class.ws.maintenance.php @@ -1816,6 +1816,19 @@ class wsMaintenance } + public static function fluidbookFarm($args) + { + global $core; + + $doc_id = $args[0] ?? 127174; + $page = $args[1] ?? 1; + + $dao = new wsDAODocument($core->con); + $doc = $dao->selectById($doc_id); + $doc->_getFileFarm($page, 'jpg', 150, true, true, 'html', true); + + } + } diff --git a/inc/ws/Metier/class.ws.document.php b/inc/ws/Metier/class.ws.document.php index 5117d6073..77ccfc5a3 100644 --- a/inc/ws/Metier/class.ws.document.php +++ b/inc/ws/Metier/class.ws.document.php @@ -440,8 +440,28 @@ class wsDocument extends cubeMetier return $this->filesdata[$cacheKey]; } + + public function _getFileFarm($page, $format = 'jpg', $resolution = 150, $withText = true, $withGraphics = true, $version = 'html', $force = false) + { + $farm = [['host' => 'elephantman.cubedesigners.com', 'port' => 22822]]; + shuffle($farm); + $farmer = array_pop($farm); + + $params = ['page' => $page, 'format' => $format, 'resolution' => $resolution, 'withText' => $withText, 'withGraphics' => $withGraphics, 'version' => $version, 'force' => $force, 'out' => $this->out,'resolutionRatio'=>$this->getResolutionRatio(),'mobileRatio'=>$this->getMobileFirstRatio()]; + $cl = new CubeIT_CommandLine('/usr/local/fluidbook_processfarm/bin/process'); + $cl->setSSH($farmer['host'], 'fluidbookfarmer', '', $farmer['port'], '/home/extranet/.ssh/id_rsa'); + $cl->setManualArg(base64_encode(json_encode($params))); + $cl->execute(); + die($cl->output); + } + public function _getFile($page, $format = 'jpg', $resolution = 150, $withText = true, $withGraphics = true, $version = 'html', $force = false) { + global $core; +// if ($core->user->utilisateur_id == 5) { +// return $this->_getFileFarm($page, $format, $resolution, $withText, $withGraphics, $version, $force); +// } + if ($format === 'jpeg') { $format = 'jpg'; -- 2.39.5