From: vincent@cubedesigners.com Date: Tue, 11 Feb 2020 15:56:20 +0000 (+0000) Subject: try #3408 @1 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=fce329b40048ab692f98779c0e9b0047673d3afd;p=cubeextranet.git try #3408 @1 --- diff --git a/inc/ws/DAO/class.ws.dao.book.php b/inc/ws/DAO/class.ws.dao.book.php index 4d13e4008..b3ce56005 100644 --- a/inc/ws/DAO/class.ws.dao.book.php +++ b/inc/ws/DAO/class.ws.dao.book.php @@ -927,18 +927,18 @@ class wsDAOBook extends commonDAO $c->update('WHERE book_id=\'' . $this->con->escape($book_id) . '\''); } - public function makeTextsIndexes($book, $pages, &$index, &$textes, $simple = false) + public function makeTextsIndexes($book, $pages, &$index, &$textes, $simple = false, $force = false) { global $core; $prefix = ''; - if ($book->parametres->textExtraction == 'poppler') { + if ($book->parametres->textExtraction === 'poppler') { $prefix = 'p'; - } else if ($book->parametres->textExtraction == 'fluidbook') { + } else if ($book->parametres->textExtraction === 'fluidbook') { $prefix = 'f'; } $dir = WS_BOOKS . '/index/' . $book->book_id; - if ($book->parametres->ignoreSearchSeparators != '') { + if ($book->parametres->ignoreSearchSeparators !== '') { $dir .= '/' . sha1($book->parametres->ignoreSearchSeparators); } if (!file_exists($dir)) { @@ -952,9 +952,12 @@ class wsDAOBook extends commonDAO } $tfilec = $dir . '/' . $prefix . 'textes.json'; - if (CubeIT_Util_Gzip::file_exists($ifilec) && CubeIT_Util_Gzip::file_exists($tfilec) && (min(CubeIT_Util_Gzip::filemtime($ifilec), CubeIT_Util_Gzip::filemtime($tfilec)) >= max($book->composition_update, filemtime(__FILE__), filemtime(WS_TOOLS . '/fwstk/out/artifacts/fwstk_jar/fwstk.jar')))) { + if (!$force && CubeIT_Util_Gzip::file_exists($ifilec) && CubeIT_Util_Gzip::file_exists($tfilec) && (min(CubeIT_Util_Gzip::filemtime($ifilec), CubeIT_Util_Gzip::filemtime($tfilec)) >= max($book->composition_update, filemtime(__FILE__), filemtime(WS_TOOLS . '/fwstk/out/artifacts/fwstk_jar/fwstk.jar')))) { $index = CubeIT_Util_Gzip::file_get_contents($ifilec); $textes = CubeIT_Util_Gzip::file_get_contents($tfilec); + if ($index === '[]') { + return $this->makeTextsIndexes($book, $pages, $index, $textes, $simple, true); + } return; }