From: vincent@cubedesigners.com Date: Mon, 28 Feb 2011 13:44:16 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=3d4dc7d0fd3c2e87c021bbf684c481d804f0e859;p=cubeextranet.git --- diff --git a/inc/ws/Controlleur/class.ws.conversion.session.php b/inc/ws/Controlleur/class.ws.conversion.session.php index a04ae6528..f9b60b5c4 100644 --- a/inc/ws/Controlleur/class.ws.conversion.session.php +++ b/inc/ws/Controlleur/class.ws.conversion.session.php @@ -99,6 +99,7 @@ class wsConversionSession { $this->updateCountPages(); $this->currentDoc = $dao->updateFromObject($this->currentDoc); + $doc_serialized = serialize($this->currentDoc); foreach($docPages as $i => $page) { $this->currentDocPage = $i + 1; @@ -111,35 +112,48 @@ class wsConversionSession { while ($t->isAlive()) { usleep(100000); } - $t->setRunnable(array($this->currentDoc, 'processOnePage')); - $t->start($page, true); + $t->setRunnable(array('wsConversionSession', 'processPage')); + $t->start($doc_serialized, $page); } else { $this->currentDoc->processOnePage($page, true); } $this->processedPages++; } - foreach($this->threads as $t) { - while ($t->isAlive()) { - usleep(100000); + if (cubeThread::available() && $this->nb_threads > 1) { + foreach($this->threads as $t) { + while ($t->isAlive()) { + usleep(100000); + } } } - $this->setProgress(($this->processedPages / $this->totalPages) * 100); - $this->currentDoc = $dao->updateFromObject($this->currentDoc); + $this->currentDoc = unserialize($doc_serialized); + + $core->reloadDBConnection(); if (!$this->reload) { // On n'ajoute les fichiers à la fin du fluidbook que si l'on // n'est pas en train de recharger le fluidbook $daoBook->appendDocument($this->bookId, $this->currentDoc->document_id); } $this->processedDoc++; + + ob_flush(); } + sleep(1); + $this->complete = true; $this->processing = false; $this->setProgress(100); } + public static function processPage($doc_serialized, $page) + { + $doc = unserialize($doc_serialized); + $doc->processOnePage($page, true); + } + public function updateCountPages() { $this->totalPages = 0; diff --git a/inc/ws/DAO/class.ws.dao.book.php b/inc/ws/DAO/class.ws.dao.book.php index 4ece529e0..a9d5dd12c 100644 --- a/inc/ws/DAO/class.ws.dao.book.php +++ b/inc/ws/DAO/class.ws.dao.book.php @@ -273,6 +273,8 @@ class wsDAOBook extends commonDAO { $c = $this->con->openCursor('books'); $c->numerotation = json_encode($num); $c->update('WHERE book_id=\'' . $this->con->escape($book_id) . '\''); + + fb('Insert Document ! ' . $book_id . ' ' . $after_page . ' ' . $document_id); } protected function decalePages($book_id, $after_page, $decalage) diff --git a/inc/ws/Metier/class.ws.document.php b/inc/ws/Metier/class.ws.document.php index 537d98239..5e4277e35 100644 --- a/inc/ws/Metier/class.ws.document.php +++ b/inc/ws/Metier/class.ws.document.php @@ -74,8 +74,6 @@ class wsDocument extends cubeMetier { if (is_null($this->conversionInfos)) { $this->conversionInfos = new wsDocumentConversionInfos(); } - - } public function copyOriginalFromUpload($tmp_file) @@ -786,7 +784,6 @@ disablelinks Disable links. fwrite($pointer, $c); } - public function __destruct() { if (isset($this->common_log_pointer) && is_resource($this->common_log_pointer)) {