]> _ Git - cubeextranet.git/commitdiff
try #3408 @1
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 11 Feb 2020 15:56:20 +0000 (15:56 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 11 Feb 2020 15:56:20 +0000 (15:56 +0000)
inc/ws/DAO/class.ws.dao.book.php

index 4d13e4008d66fa08108b91c5068038eae5dbbded..b3ce5600531b22fd919fc431eb90df10ba38dad8 100644 (file)
@@ -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;
         }