protected function doExportCompiledDelivery($path, core_kernel_classes_Resource $compiledDelivery, \ZipArchive $zipArchive)
    {
        $taoDeliveryVersion = \common_ext_ExtensionsManager::singleton()->getInstalledVersion('taoDelivery');

        $data = array(
            'dir' => array(),
            'label' => $compiledDelivery->getLabel(),
            'version' => $taoDeliveryVersion
        );
        $directories = $compiledDelivery->getPropertyValues(new core_kernel_classes_Property(DeliveryAssemblyService::PROPERTY_DELIVERY_DIRECTORY));
        foreach ($directories as $id) {
            $directory = \tao_models_classes_service_FileStorage::singleton()->getDirectoryById($id);
            $files = $directory->getIterator();
            foreach ($files as $file) {
                \tao_helpers_File::addFilesToZip($zipArchive, $directory->readPsrStream($file), $directory->getRelativePath() . $file);
            }
            $data['dir'][$id] = $directory->getRelativePath();
        }

        $runtime = $compiledDelivery->getUniquePropertyValue(new core_kernel_classes_Property(DeliveryAssemblyService::PROPERTY_DELIVERY_RUNTIME));
        $serviceCall = \tao_models_classes_service_ServiceCall::fromResource($runtime);
        $data['runtime'] = base64_encode($serviceCall->serializeToString());

        $rdfExporter = new \tao_models_classes_export_RdfExporter();
        $rdfdata = $rdfExporter->getRdfString(array($compiledDelivery));
        if (!$zipArchive->addFromString('delivery.rdf', $rdfdata)) {
            throw new \common_Exception('Unable to add metadata to exported delivery assembly');
        }
        $data['meta'] = 'delivery.rdf';


        $content = json_encode($data);
        if (!$zipArchive->addFromString(self::MANIFEST_FILE, $content)) {
            $zipArchive->close();
            unlink($path);
            throw new \common_Exception('Unable to add manifest to exported delivery assembly');
        }
    }
protected function doExportCompiledDelivery($path, core_kernel_classes_Resource $compiledDelivery, \ZipArchive $zipArchive)
    {
        $taoDeliveryVersion = \common_ext_ExtensionsManager::singleton()->getInstalledVersion('taoDelivery');

        $data = array(
            'dir' => array(),
            'label' => $compiledDelivery->getLabel(),
            'version' => $taoDeliveryVersion
        );
        $directories = $compiledDelivery->getPropertyValues(new core_kernel_classes_Property(DeliveryAssemblyService::PROPERTY_DELIVERY_DIRECTORY));
        foreach ($directories as $id) {
            $directory = \tao_models_classes_service_FileStorage::singleton()->getDirectoryById($id);
            $files = $directory->getIterator();
            foreach ($files as $file) {
                \tao_helpers_File::addFilesToZip($zipArchive, $directory->readPsrStream($file), $directory->getRelativePath() . $file);
            }
            $data['dir'][$id] = $directory->getRelativePath();
        }

        $runtime = $compiledDelivery->getUniquePropertyValue(new core_kernel_classes_Property(DeliveryAssemblyService::PROPERTY_DELIVERY_RUNTIME));
        $serviceCall = \tao_models_classes_service_ServiceCall::fromResource($runtime);
        $data['runtime'] = base64_encode($serviceCall->serializeToString());

        $rdfExporter = new \tao_models_classes_export_RdfExporter();
        $rdfdata = $rdfExporter->getRdfString(array($compiledDelivery));
        if (!$zipArchive->addFromString('delivery.rdf', $rdfdata)) {
            throw new \common_Exception('Unable to add metadata to exported delivery assembly');
        }
        $data['meta'] = 'delivery.rdf';


        $content = json_encode($data);
        if (!$zipArchive->addFromString(self::MANIFEST_FILE, $content)) {
            $zipArchive->close();
            unlink($path);
            throw new \common_Exception('Unable to add manifest to exported delivery assembly');
        }
    }
protected function doExportCompiledDelivery ( $ path , core_kernel_classes_Resource $ compiledDelivery , \ ZipArchive $ zipArchive ) { $ taoDeliveryVersion = \ common_ext_ExtensionsManager :: singleton ( ) -> getInstalledVersion ( 'taoDelivery' ) ; $ data = array ( 'dir' => array ( ) , 'label' => $ compiledDelivery -> getLabel ( ) , 'version' => $ taoDeliveryVersion ) ; $ directories = $ compiledDelivery -> getPropertyValues ( new core_kernel_classes_Property ( DeliveryAssemblyService :: PROPERTY_DELIVERY_DIRECTORY ) ) ; foreach ( $ directories as $ id ) { $ directory = \ tao_models_classes_service_FileStorage :: singleton ( ) -> getDirectoryById ( $ id ) ; $ files = $ directory -> getIterator ( ) ; foreach ( $ files as $ file ) { \ tao_helpers_File :: addFilesToZip ( $ zipArchive , $ directory -> readPsrStream ( $ file ) , $ directory -> getRelativePath ( ) . $ file ) ; } $ data [ 'dir' ] [ $ id ] = $ directory -> getRelativePath ( ) ; } $ runtime = $ compiledDelivery -> getUniquePropertyValue ( new core_kernel_classes_Property ( DeliveryAssemblyService :: PROPERTY_DELIVERY_RUNTIME ) ) ; $ serviceCall = \ tao_models_classes_service_ServiceCall :: fromResource ( $ runtime ) ; $ data [ 'runtime' ] = base64_encode ( $ serviceCall -> serializeToString ( ) ) ; $ rdfExporter = new \ tao_models_classes_export_RdfExporter ( ) ; $ rdfdata = $ rdfExporter -> getRdfString ( array ( $ compiledDelivery ) ) ; if ( ! $ zipArchive -> addFromString ( 'delivery.rdf' , $ rdfdata ) ) { throw new \ common_Exception ( 'Unable to add metadata to exported delivery assembly' ) ; } $ data [ 'meta' ] = 'delivery.rdf' ; $ content = json_encode ( $ data ) ; if ( ! $ zipArchive -> addFromString ( self :: MANIFEST_FILE , $ content ) ) { $ zipArchive -> close ( ) ; unlink ( $ path ) ; throw new \ common_Exception ( 'Unable to add manifest to exported delivery assembly' ) ; } }
Do Export Compiled Delivery

Method containing the main behavior of exporting a compiled delivery into a ZIP archive.

For developers wanting to override this method, the following information has to be taken into account:

- The value of the $zipArgive argument is an already open ZipArchive object.
- The method must keep the archive open after its execution (calling code will take care of it).

@param $path
@param core_kernel_classes_Resource $compiledDelivery
@param \ZipArchive $zipArchive
@throws \common_Exception
@throws \core_kernel_classes_EmptyProperty
Do Export Compiled Delivery