- '/mnt/sshfs/godzilla/data/fluidbook/docs/:/application/protected/fluidbookpublication/docs/'
- '/data/extranet/www/fluidbook/books/working/:/application/protected/fluidbookpublication/working/'
- '/data/extranet/www/fluidbook/books/links/:/application/protected/fluidbookpublication/links/'
+ - '/home/extranet/www/fluidbook/cache/unzip/:/application/storage/fluidbook/cache/unzip/'
- '/home/extranet:/home/extranet'
- '/data/extranet:/data/extranet'
- '/mnt:/mnt'
- '/mnt/sshfs/godzilla/data/fluidbook/docs/:/application/protected/fluidbookpublication/docs/'
- '/data/extranet/www/fluidbook/books/working/:/application/protected/fluidbookpublication/working/'
- '/data/extranet/www/fluidbook/books/links/:/application/protected/fluidbookpublication/links/'
+ - '/data/extranet/www/fluidbook/cache/unzip/:/application/storage/fluidbook/cache/unzip/'
- '/home/extranet:/home/extranet'
- '/data/extranet:/data/extranet'
- '/mnt:/mnt'
use Cubist\Util\Text;
use Cubist\Util\Url;
use Cubist\Util\WebVideo;
+use Cubist\Util\Zip;
use DOMDocument;
use DOMElement;
use DOMXPath;
{
Log::error($e);
- $c=explode('\\',get_class($link));
- $type=array_pop($c);
- $type=str_replace('Link','',$type);
+ $c = explode('\\', get_class($link));
+ $type = array_pop($c);
+ $type = str_replace('Link', '', $type);
- throw new \Exception('Error on the '.$type.' link to ' . $link->to . ' on page ' . $link->page . ' with message : ' . $e->getMessage());
+ throw new \Exception('Error on the ' . $type . ' link to ' . $link->to . ' on page ' . $link->page . ' with message : ' . $e->getMessage());
}
protected function _htmlLinkList($list)
public function unzipFile($file, $moveAssets = false, $baseDir = null)
{
- $fdir = is_null($baseDir) ? 'data/links/' . str_replace('.', '_', $file) : $baseDir;
+ $fdir = is_null($baseDir) ? 'data/links/' . str_replace('.', '_', $file) : commonTools::fixpath($baseDir);
+
+ $zipPath = $this->wdir . '/' . $file;
+ $dir = storage_path('fluidbook/cache/unzip') . Files::hashFileAttributes($zipPath);
- $tmp = Files::tmpdir();
- $dir = $tmp . '/' . $fdir;
- if (file_exists($dir) && is_file($dir)) {
- unlink($dir);
- }
if (!file_exists($dir)) {
mkdir($dir, 0777, true);
- }
- $unzip = new CommandLine('unzip');
- $unzip->setArg(null, $this->wdir . '/' . $file);
- $unzip->setArg('d', $dir);
- $unzip->execute();
-
- if ($moveAssets) {
- `mv $dir/Assets/* $dir`;
- rmdir($dir . '/Assets');
+ Zip::extract($zipPath, $dir);
+ if ($moveAssets) {
+ `mv $dir/Assets/* $dir`;
+ rmdir($dir . '/Assets');
+ }
}
return array('dir' => $dir, 'fdir' => $fdir);
} else {
$r = array('html' => false, 'inject' => array(file_get_contents($d . '/init.js')), 'injectcss' => array('multimedia.css'), 'injectjs' => array('multimedia.js'));
}
- $res = array_merge($res, $r);
- return $res;
+ return array_merge($res, $r);
}
public function addFontKit($font)