]> _ Git - cubeextranet.git/commitdiff
wip #1998 @0:01
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Fri, 15 Jun 2018 14:57:03 +0000 (14:57 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Fri, 15 Jun 2018 14:57:03 +0000 (14:57 +0000)
inc/ws/Controlleur/class.ws.services.php
inc/ws/Util/packager/class.ws.packager.php

index 543c9b9e98b4e482589162fac68dec146a6a5b13..728b06a1e428659ee1c1c5b625b62f53e0be9b1a 100644 (file)
@@ -1205,11 +1205,11 @@ class wsServices extends cubeFlashGateway
                        file_put_contents('/tmp/bourbonSuggestion', print_r($e, true));
                }
 
-               $body = "Hello,\r\nThis automatic message confirm that your suggestion has been received.\r\nPlease do not reply to this e-mail,\r\nThank you";
+               $body = "Hello,\r\nThis automatic message confirms that your suggestion has been received.\r\nPlease do not reply to this e-mail,\r\nThank you";
 
                $ack = new Zend_Mail();
                $ack->setFrom('no-reply@bourbonoffshore.com');
-               $ack->setSubject('Suggestion ackknowledge');
+               $ack->setSubject('Suggestion acknowledge');
                $ack->setBodyText($body);
 
                $ack->addTo($from);
index d164c8231da49ba1d2af1e93a9e51a302664c659..c2d0d74ea130dc965c9fb11f784f394a053a6e30 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 
-class wsPackager {
+class wsPackager
+{
 
        protected $dir;
        protected $vdir;
@@ -17,7 +18,8 @@ class wsPackager {
        protected $_clean = true;
        public $cleanOnDestruct = true;
 
-       public static function package($book_id, $version, $zip = true, $cleanOnDestruct = true) {
+       public static function package($book_id, $version, $zip = true, $cleanOnDestruct = true)
+       {
                global $packager;
 
                cubePHP::neverStop();
@@ -53,7 +55,8 @@ class wsPackager {
                return $packager->makePackage($zip);
        }
 
-       public function __construct($book_id, $vdir = null, $whole = true) {
+       public function __construct($book_id, $vdir = null, $whole = true)
+       {
 
                $this->_clean = (null === $vdir);
                global $core;
@@ -81,19 +84,23 @@ class wsPackager {
                $this->compile();
        }
 
-       protected function compile() {
+       protected function compile()
+       {
                $this->daoBook->compile($this->book_id, '2', false, $this->book->parametres->forceCompileOnDownload);
        }
 
-       protected function preparePackage() {
+       protected function preparePackage()
+       {
                $this->initTempDir();
        }
 
-       public function makePackage($zip) {
+       public function makePackage($zip)
+       {
                $this->preparePackage();
        }
 
-       protected function replaceContents($str, $toReplace) {
+       protected function replaceContents($str, $toReplace)
+       {
                $res = $str;
                foreach ($toReplace as $k => $v) {
                        if (is_null($v)) {
@@ -104,7 +111,8 @@ class wsPackager {
                return $res;
        }
 
-       protected function copyFluidbookFiles() {
+       protected function copyFluidbookFiles()
+       {
                // Copie du FB vers un rĂ©pertoire temporaire
                $cp = new cubeCommandLine('cp');
                $cp->setArg('R');
@@ -114,7 +122,8 @@ class wsPackager {
                $cp->execute();
        }
 
-       protected function copyOtherFiles($files) {
+       protected function copyOtherFiles($files)
+       {
                foreach ($files as $source => $dest) {
                        if (is_int($source)) {
                                $source = $dest;
@@ -139,15 +148,18 @@ class wsPackager {
                }
        }
 
-       protected function getBaseFile() {
+       protected function getBaseFile()
+       {
                return $this->version . '-' . date('Ymdhis', TIME) . '-' . cubeText::str2URL($this->book->parametres->title);
        }
 
-       protected function getRelativeBase() {
+       protected function getRelativeBase()
+       {
                return '/packager/download/' . $this->getBaseFile();
        }
 
-       protected function getURLBase($ext = '') {
+       protected function getURLBase($ext = '')
+       {
                $res = '/fluidbook' . $this->getRelativeBase();
                if ($ext != '') {
                        $res .= '.' . $ext;
@@ -155,7 +167,8 @@ class wsPackager {
                return $res;
        }
 
-       protected function getPathBase($ext = '') {
+       protected function getPathBase($ext = '')
+       {
                $res = WS_FILES . $this->getRelativeBase();
                if ($ext != '') {
                        $res .= '.' . $ext;
@@ -164,7 +177,8 @@ class wsPackager {
                return $res;
        }
 
-       protected function zip($zipfile = null) {
+       protected function zip($zipfile = null)
+       {
                if (!$this->whole) {
                        return;
                }
@@ -177,18 +191,19 @@ class wsPackager {
                        $rename = true;
                }
 
-               $dir=$this->getFinalPackageDir();
-               if(file_exists($dir)) {
-            $zip = new cubeCommandLine('zip');
-            $zip->cd($dir);
-            $zip->setArg(null, $zipfile);
-            $zip->setArg('symlinks');
-            $zip->setArg('0');
-            $zip->setArg('r');
-            $zip->setArg('u');
-            $zip->setArg(null, '.');
-            $zip->execute();
-        }
+               $dir = $this->getFinalPackageDir();
+               if (file_exists($dir)) {
+                       $zip = new CubeIT_CommandLine('zip');
+                       $zip->cd($dir);
+                       $zip->setArg(null, $zipfile);
+                       $zip->setArg('symlinks');
+                       $zip->setArg('0');
+                       $zip->setArg('r');
+                       $zip->setArg('u');
+                       $zip->setArg(null, '.');
+                       $zip->setManualArg('-x "*/\.*"');
+                       $zip->execute();
+               }
 
                if (!file_exists(WS_FILES . '/packager/download')) {
                        mkdir(WS_FILES . '/packager/download', 0777, true);
@@ -200,7 +215,8 @@ class wsPackager {
                return $url;
        }
 
-       public function getFinalPackageDir() {
+       public function getFinalPackageDir()
+       {
                $dir = $this->vdir;
                if ($this->book->parametres->alwaysHTML5) {
                        $dir .= '/m/';
@@ -208,7 +224,8 @@ class wsPackager {
                return $dir;
        }
 
-       protected function initTempDir() {
+       protected function initTempDir()
+       {
                if (is_null($this->vdir)) {
                        $this->vdir = $this->dir . $this->version . '/';
                }
@@ -218,7 +235,8 @@ class wsPackager {
                }
        }
 
-       protected function cleanVdir() {
+       protected function cleanVdir()
+       {
                if (!$this->_clean) {
                        return;
                }
@@ -232,7 +250,8 @@ class wsPackager {
                }
        }
 
-       protected function moveDatasSWF() {
+       protected function moveDatasSWF()
+       {
                if (file_exists($this->vdir . '/FluidbookDatas.swf')) {
                        rename($this->vdir . '/FluidbookDatas.swf', $this->vdir . '/data/FluidbookDatas.swf');
                }
@@ -241,17 +260,20 @@ class wsPackager {
                }
        }
 
-       protected function postPackage() {
+       protected function postPackage()
+       {
 
        }
 
-       public function __destruct() {
+       public function __destruct()
+       {
                if ($this->whole && $this->cleanOnDestruct) {
                        $this->cleanVdir();
                }
        }
 
-       public function copy($source, $dest) {
+       public function copy($source, $dest)
+       {
                if (!file_exists($source)) {
                        return;
                }