From 11b181a2c6e6b3354fdcb662e6094a657f490d89 Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Fri, 29 Sep 2017 15:10:32 +0000 Subject: [PATCH] wip #1704 @1 --- inc/ws/DAO/class.ws.dao.book.php | 38 +++++++++----------------------- 1 file changed, 10 insertions(+), 28 deletions(-) diff --git a/inc/ws/DAO/class.ws.dao.book.php b/inc/ws/DAO/class.ws.dao.book.php index 734d3191e..93eb9b522 100644 --- a/inc/ws/DAO/class.ws.dao.book.php +++ b/inc/ws/DAO/class.ws.dao.book.php @@ -1136,12 +1136,7 @@ class wsDAOBook extends commonDAO { $compilerDir = WS_BOOKS . '/datasCompiler/' . $book_id . '/'; $finalDir = WS_BOOKS . '/final/' . $book_id . '/'; - $rm = new cubeCommandLine('rm'); - $rm->setArg('r'); - $rm->setArg('f'); - $rm->setArg(null, $finalDir); - $rm->execute(); - mkdir($finalDir, 0777, true); + $vdir = new CubeIT_Files_VirtualDirectory($finalDir); $debug = false; @@ -1149,7 +1144,7 @@ class wsDAOBook extends commonDAO { $flexLight = new cubeFlexCompiler('FluidbookDatasLight', $compilerDir, 'flash.display.Sprite', explode(';', AS3_SOURCES), MXMLC_PATH, 10, 30, 800, 600, $debug); $filesToCopy = array(); - $this->compileFlex($book_id, $complete, $compilerDir, $finalDir, $filesToCopy, $book, $pages, $flex, $flexLight, $finalDir); + $this->compileFlex($book_id, $complete, $compilerDir, $vdir, $filesToCopy, $book, $pages, $flex, $flexLight, $finalDir); $res .= $flex->compile() . "\n\n-------------------\n\n"; $flexLight->addVariable('datasSize', filesize($compilerDir . '/FluidbookDatas.swf')); @@ -1160,30 +1155,15 @@ class wsDAOBook extends commonDAO { // Copy of files // Check if dest dir exists - if (!file_exists($finalDir . 'data')) { - mkdir($finalDir . 'data', 0777, true); - } foreach ($filesToCopy as $local => $source) { - $localPath = $finalDir . $local; - if (!file_exists($localPath) || filemtime($localPath) != filemtime($source) || filesize($localPath) != filesize($source) || filemtime($localPath) < $book->composition_update) { - if (is_dir($source)) { - continue; - } - $this->copy($source, $localPath); - } + $localPath = $local; + $vdir->copy($source, $localPath); } $workingDir = WS_BOOKS . '/working/' . $book_id . '/'; - if (file_exists($workingDir . 'media')) { - $cp = new cubeCommandLine('cp'); - $cp->setPath(CONVERTER_PATH); - $cp->setArg('r'); - $cp->setArg('p'); - $cp->setArg(null, $workingDir . 'media'); - $cp->setArg(null, $finalDir . 'data'); - $cp->execute(); - } + $vdir->copyDirectory($workingDir . 'media', 'data'); + $vdir->sync(true); return $res; } @@ -1236,7 +1216,9 @@ class wsDAOBook extends commonDAO { return $res; } - public function compileFlex($book_id, $complete, $compilerDir, $finalDir, &$filesToCopy, $book, $pages, $flex, $flexLight, $finalDir) { + public function compileFlex($book_id, $complete, $compilerDir, $vdir, &$filesToCopy, $book, $pages, $flex, $flexLight) { + /* @var $vdir CubeIT_Files_VirtualDirectory */ + cubePHP::neverStop(); /* @var $flex cubeFlexCompiler */ @@ -1547,7 +1529,7 @@ class wsDAOBook extends commonDAO { } elseif ($ext == 'xlsx') { $references = wsUtil::excelToArray($referencesFile); if ($book->parametres->customLinkClass == 'AtlanticDownloadLink') { - $references = wsUtil::atlanticReferences($this->config->basketReferences, $finalDir . '/local/'); + $references = wsUtil::atlanticReferences($references, 'local/', null, array($vdir, 'copy')); } $flex->addVariable('basketReferences', $references, false, true, "OrderedObject"); } -- 2.39.5