$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;
$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'));
// 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;
}
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 */
} 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");
}