public function exportCompiledDelivery(core_kernel_classes_Resource $compiledDelivery, $fsExportPath = '') {

        $this->logDebug("Exporting Delivery Assembly '" . $compiledDelivery->getUri() . "'...");

        $fileName = \tao_helpers_Display::textCleaner($compiledDelivery->getLabel()).'.zip';
        $path = \tao_helpers_File::concat(array(\tao_helpers_Export::getExportPath(), $fileName));
        if (!\tao_helpers_File::securityCheck($path, true)) {
            throw new \Exception('Unauthorized file name');
        }

        // If such a target zip file exists, remove it from local filesystem. It prevents some synchronicity issues
        // to occur while dealing with ZIP Archives (not explained yet).
        if (file_exists($path)) {
            unlink($path);
        }
        
        $zipArchive = new \ZipArchive();
        if ($zipArchive->open($path, \ZipArchive::CREATE) !== true) {
            throw new \Exception('Unable to create archive at '.$path);
        }

        $this->doExportCompiledDelivery($path, $compiledDelivery, $zipArchive);
        $zipArchive->close();

        if (!empty($fsExportPath)) {
            $this->logDebug("Writing Delivery Assembly '" . $compiledDelivery->getUri() . "' into shared file system at location '${fsExportPath}'...");
            $fsExportPath = trim($fsExportPath);
            $fsExportPath = ltrim($fsExportPath,"/\\");

            $zipArchiveHandler = fopen($path, 'r');
            $this->getExportDirectory()->getFile($fsExportPath)->put($zipArchiveHandler);
            fclose($zipArchiveHandler);
        }

        return $path;
    }
public function exportCompiledDelivery(core_kernel_classes_Resource $compiledDelivery, $fsExportPath = '') {

        $this->logDebug("Exporting Delivery Assembly '" . $compiledDelivery->getUri() . "'...");

        $fileName = \tao_helpers_Display::textCleaner($compiledDelivery->getLabel()).'.zip';
        $path = \tao_helpers_File::concat(array(\tao_helpers_Export::getExportPath(), $fileName));
        if (!\tao_helpers_File::securityCheck($path, true)) {
            throw new \Exception('Unauthorized file name');
        }

        // If such a target zip file exists, remove it from local filesystem. It prevents some synchronicity issues
        // to occur while dealing with ZIP Archives (not explained yet).
        if (file_exists($path)) {
            unlink($path);
        }
        
        $zipArchive = new \ZipArchive();
        if ($zipArchive->open($path, \ZipArchive::CREATE) !== true) {
            throw new \Exception('Unable to create archive at '.$path);
        }

        $this->doExportCompiledDelivery($path, $compiledDelivery, $zipArchive);
        $zipArchive->close();

        if (!empty($fsExportPath)) {
            $this->logDebug("Writing Delivery Assembly '" . $compiledDelivery->getUri() . "' into shared file system at location '${fsExportPath}'...");
            $fsExportPath = trim($fsExportPath);
            $fsExportPath = ltrim($fsExportPath,"/\\");

            $zipArchiveHandler = fopen($path, 'r');
            $this->getExportDirectory()->getFile($fsExportPath)->put($zipArchiveHandler);
            fclose($zipArchiveHandler);
        }

        return $path;
    }
public function exportCompiledDelivery ( core_kernel_classes_Resource $ compiledDelivery , $ fsExportPath = '' ) { $ this -> logDebug ( "Exporting Delivery Assembly '" . $ compiledDelivery -> getUri ( ) . "'..." ) ; $ fileName = \ tao_helpers_Display :: textCleaner ( $ compiledDelivery -> getLabel ( ) ) . '.zip' ; $ path = \ tao_helpers_File :: concat ( array ( \ tao_helpers_Export :: getExportPath ( ) , $ fileName ) ) ; if ( ! \ tao_helpers_File :: securityCheck ( $ path , true ) ) { throw new \ Exception ( 'Unauthorized file name' ) ; } // If such a target zip file exists, remove it from local filesystem. It prevents some synchronicity issues // to occur while dealing with ZIP Archives (not explained yet). if ( file_exists ( $ path ) ) { unlink ( $ path ) ; } $ zipArchive = new \ ZipArchive ( ) ; if ( $ zipArchive -> open ( $ path , \ ZipArchive :: CREATE ) !== true ) { throw new \ Exception ( 'Unable to create archive at ' . $ path ) ; } $ this -> doExportCompiledDelivery ( $ path , $ compiledDelivery , $ zipArchive ) ; $ zipArchive -> close ( ) ; if ( ! empty ( $ fsExportPath ) ) { $ this -> logDebug ( "Writing Delivery Assembly '" . $ compiledDelivery -> getUri ( ) . "' into shared file system at location '${fsExportPath}'..." ) ; $ fsExportPath = trim ( $ fsExportPath ) ; $ fsExportPath = ltrim ( $ fsExportPath , "/\\" ) ; $ zipArchiveHandler = fopen ( $ path , 'r' ) ; $ this -> getExportDirectory ( ) -> getFile ( $ fsExportPath ) -> put ( $ zipArchiveHandler ) ; fclose ( $ zipArchiveHandler ) ; } return $ path ; }
export a compiled delivery into an archive

@param core_kernel_classes_Resource $compiledDelivery
@param string $fsExportPath
@throws \Exception
@return string
export a compiled delivery into an archive