protected $multiApp = false;
protected $pageLabels = array();
protected $stylesheets = array();
+ protected $logfp = null;
+ protected $logtime = null;
function __construct($book_id, $version = 'stable', $phonegap = false, $phonegapVersion = 'latest', $dir = null, $standalone = false, $appcache = false, $home = false) {
global $core;
+
$this->phonegapVersion = wsHTML5::getPhonegapVersion($phonegapVersion);
$this->appcache = $appcache;
$this->multiApp = $this->home = $home;
return;
}
$this->book_id = $book_id;
+ $this->log('Start compilation');
if (is_null($dir)) {
$this->dir = WS_BOOKS . '/html5/' . $book_id . '/';
if (!file_exists($this->dir)) {
mkdir($this->dir, 0777, true);
}
+ $this->log('Clean vdir');
$this->daoBook = new wsDAOBook($core->con);
$this->book = $this->daoBook->selectById($book_id);
$this->config = cubeObject::merge($this->book->parametres->toStandardObject(), $this->theme->parametres->toStandardObject());
}
+ public function log($step) {
+ $currenttime = microtime(true);
+ if (null === $this->logfp) {
+ $this->logfp = fopen('/var/log/extranet/htmlconversions/' . $this->book_id . '.log', 'w+');
+ }
+ if (null === $this->logtime) {
+ $this->logtime = $currenttime;
+ }
+ $time = $currenttime - $this->logtime;
+ $log = $step . ' | ' . round($time, 3) . 's' . "\n";
+ fwrite($this->logfp, $log);
+ $this->logtime = $currenttime;
+ }
+
public function addPageLabel($page, $label) {
$this->pageLabels[$label] = $page;
}
public function compile() {
+ $this->log('Start compile process');
+
$dirsToCreate = array('data/images', 'data/contents', 'data/background', 'data/thumbnails', 'data/style');
if (in_array('flv', $this->getVideosFormats())) {
$dirsToCreate[] = 'swf';
if (file_exists($this->vdir . '/swf')) {
$this->copy($this->assets . '/swf/video.swf', $this->vdir . '/swf/video.swf');
}
-
+ $this->log('Copied assets');
$this->loadPlugins();
+ $this->log('Plugins loaded');
$this->writeImages();
+ $this->log('Images written');
$linksCSS = $this->writeLinks();
+ $this->log('Links written');
$this->writeCSS($this->vdir . '/data/style/style_%d.css', $linksCSS);
+ $this->log('CSS written');
$this->writeLangs();
+ $this->log('Langs written');
$this->writeIndex();
+ $this->log('Index written');
$this->writeTexts();
+ $this->log('Texts written');
$this->writeExtras();
+ $this->log('Extras written');
$this->writeJs();
+ $this->log('Js written');
$this->writeCache();
+ $this->log('Cache written');
}
protected function loadPlugins() {