From: vincent@cubedesigners.com Date: Tue, 8 Sep 2020 15:37:57 +0000 (+0000) Subject: wait #3872 @1.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=c08d6e5c6376a660fb1b666daa9a256eccf145af;p=cubeextranet.git wait #3872 @1.5 --- diff --git a/composer.json b/composer.json index 6abd43841..befbdbe91 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,7 @@ { "require": { "php": ">=7.2", - "php-mime-mail-parser/php-mime-mail-parser": "2.11.1" + "php-mime-mail-parser/php-mime-mail-parser": "2.11.1", + "jaybizzle/crawler-detect": "^1.2" } } diff --git a/inc/prepend.php b/inc/prepend.php index 321941083..33215784b 100644 --- a/inc/prepend.php +++ b/inc/prepend.php @@ -6,6 +6,7 @@ if (!isset($_SERVER['SERVER_ADDR'])) { } } + // Inclusion du fichier de configuration require_once(dirname(__FILE__) . '/config.inc.php'); // Chargement de la classe cube @@ -25,6 +26,9 @@ require_once 'Zend/Loader/Autoloader.php'; $loader = Zend_Loader_Autoloader::getInstance(); $loader->registerNamespace('CubeIT_'); + +require_once __DIR__.'/../vendor/autoload.php'; + if ($ws) { define('GA', 'UA-4339912-7'); define('MAIL_BCC', 'tech@fluidbook.com'); diff --git a/inc/ws/Controlleur/class.ws.maintenance.php b/inc/ws/Controlleur/class.ws.maintenance.php index 085946919..ed463dcd4 100644 --- a/inc/ws/Controlleur/class.ws.maintenance.php +++ b/inc/ws/Controlleur/class.ws.maintenance.php @@ -1316,6 +1316,22 @@ class wsMaintenance unlink($tmp); exit; } + + public static function prepareSocialImages() + { + global $core; + + CubeIT_Util_PHP::neverStop(); + $dao = new wsDAOBook($core->con); + $books = $dao->selectAll(); + foreach ($books as $book) { + file_get_contents('https://workshop.fluidbook.com/services/facebook_thumbnail?cid=' . $book->cid . '&j=' . TIME); + } + } + + public static function _socialImage($cid){ + file_get_contents('https://workshop.fluidbook.com/services/facebook_thumbnail?cid=' . $cid . '&j=' . TIME); + } } diff --git a/inc/ws/Controlleur/class.ws.services.php b/inc/ws/Controlleur/class.ws.services.php index ed7545e3f..30ef8aa9b 100644 --- a/inc/ws/Controlleur/class.ws.services.php +++ b/inc/ws/Controlleur/class.ws.services.php @@ -192,14 +192,18 @@ class wsServices extends cubeFlashGateway if (file_exists($c)) { $cover = $c; } - } else { + } + + if (!isset($cover)) { $cover = WS_FILES . '/social_image/' . $id . '.jpg'; - $limit = TIME - (3600 * 24 * 3); + $limit = TIME - (3600 * 24 * 5); + if (isset($_GET['force']) || !file_exists($cover) || filemtime($cover) < $limit) { $w = 1200; $h = 628; $tmp = CubeIT_Files::tempnam() . '.svg'; $cl = new CubeIT_CommandLine('xvfb-run'); + $cl->setArg('a'); $cl->setArg('server-args', '-screen 0, ' . $w . 'x' . $h . 'x24'); $cl->setArg(null, '/usr/bin/cutycapt'); $cl->setArg('min-width', $w); @@ -211,14 +215,13 @@ class wsServices extends cubeFlashGateway $cl->execute(); $cl->debug(); - $geo=$w.'x'.$h; + $geo = $w . 'x' . $h; `convert $tmp -crop $geo+0+0 +repage -resize $geo -flatten $cover`; unlink($tmp); } } } - cubeHTTP::relayFile($cover); exit; } diff --git a/inc/ws/Controlleur/class.ws.url.php b/inc/ws/Controlleur/class.ws.url.php index b96d77c7c..d36fa2899 100644 --- a/inc/ws/Controlleur/class.ws.url.php +++ b/inc/ws/Controlleur/class.ws.url.php @@ -1,5 +1,6 @@ isCrawler()) { $book->parametres->scorm_enable = false; $dao->compile($book_id, 'html5', false, false, false, $book, false); + wsMaintenance::_socialImage($book->cid); } $book_id = $e[0]; diff --git a/inc/ws/Metier/class.ws.document.php b/inc/ws/Metier/class.ws.document.php index e30cd1b71..1db28b0b5 100644 --- a/inc/ws/Metier/class.ws.document.php +++ b/inc/ws/Metier/class.ws.document.php @@ -110,7 +110,7 @@ class wsDocument extends cubeMetier public function copyOriginalFromOlderVersion() { if (!file_exists($this->in)) { - copy('https://ws.fluidbook.com/docs/' . $this->document_id . '/original.pdf', $this->in); + // copy('https://ws.fluidbook.com/docs/' . $this->document_id . '/original.pdf', $this->in); } } diff --git a/vendor/composer/ClassLoader.php b/vendor/composer/ClassLoader.php index 95f7e0978..fce8549f0 100644 --- a/vendor/composer/ClassLoader.php +++ b/vendor/composer/ClassLoader.php @@ -279,7 +279,7 @@ class ClassLoader */ public function setApcuPrefix($apcuPrefix) { - $this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null; + $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null; } /** diff --git a/vendor/composer/autoload_psr4.php b/vendor/composer/autoload_psr4.php index 9ea3b7776..6ae49c2b6 100644 --- a/vendor/composer/autoload_psr4.php +++ b/vendor/composer/autoload_psr4.php @@ -7,4 +7,5 @@ $baseDir = dirname($vendorDir); return array( 'PhpMimeMailParser\\' => array($vendorDir . '/php-mime-mail-parser/php-mime-mail-parser/src'), + 'Jaybizzle\\CrawlerDetect\\' => array($vendorDir . '/jaybizzle/crawler-detect/src'), ); diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 62403a9eb..7bb508acf 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -11,6 +11,10 @@ class ComposerStaticInit920111649f7e87249f1f2fbc0fd23976 array ( 'PhpMimeMailParser\\' => 18, ), + 'J' => + array ( + 'Jaybizzle\\CrawlerDetect\\' => 24, + ), ); public static $prefixDirsPsr4 = array ( @@ -18,6 +22,10 @@ class ComposerStaticInit920111649f7e87249f1f2fbc0fd23976 array ( 0 => __DIR__ . '/..' . '/php-mime-mail-parser/php-mime-mail-parser/src', ), + 'Jaybizzle\\CrawlerDetect\\' => + array ( + 0 => __DIR__ . '/..' . '/jaybizzle/crawler-detect/src', + ), ); public static function getInitializer(ClassLoader $loader) diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 037daaa55..bc1984c69 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -1,4 +1,55 @@ [ + { + "name": "jaybizzle/crawler-detect", + "version": "v1.2.99", + "version_normalized": "1.2.99.0", + "source": { + "type": "git", + "url": "https://github.com/JayBizzle/Crawler-Detect.git", + "reference": "0ffea34489b258a2709bfe93a9553e1efa5d1904" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/JayBizzle/Crawler-Detect/zipball/0ffea34489b258a2709bfe93a9553e1efa5d1904", + "reference": "0ffea34489b258a2709bfe93a9553e1efa5d1904", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8|^5.5|^6.5", + "satooshi/php-coveralls": "1.*" + }, + "time": "2020-08-25T21:35:55+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "Jaybizzle\\CrawlerDetect\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mark Beech", + "email": "m@rkbee.ch", + "role": "Developer" + } + ], + "description": "CrawlerDetect is a PHP class for detecting bots/crawlers/spiders via the user agent", + "homepage": "https://github.com/JayBizzle/Crawler-Detect/", + "keywords": [ + "crawler", + "crawler detect", + "crawler detector", + "crawlerdetect", + "php crawler detect" + ] + }, { "name": "php-mime-mail-parser/php-mime-mail-parser", "version": "2.11.1",