当前位置: 首页>>代码示例>>PHP>>正文


PHP tao_helpers_File::addFilesToZip方法代码示例

本文整理汇总了PHP中tao_helpers_File::addFilesToZip方法的典型用法代码示例。如果您正苦于以下问题:PHP tao_helpers_File::addFilesToZip方法的具体用法?PHP tao_helpers_File::addFilesToZip怎么用?PHP tao_helpers_File::addFilesToZip使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tao_helpers_File的用法示例。


在下文中一共展示了tao_helpers_File::addFilesToZip方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addFile

 /**
  * Add files or folders (and their content) to the Zip Archive that will contain all the files to the current export session.
  * For instance, if you want to copy the file 'taoItems/data/i123/item.xml' as 'myitem.xml' to your archive call addFile('path_to_item_location/item.xml', 'myitem.xml').
  * As a result, you will get a file entry in the final ZIP archive at '/i123/myitem.xml'.
  * 
  * @param string | StreamInterface $src The path to the source file or folder to copy into the ZIP Archive.
  * @param string *dest The <u>relative</u> to the destination within the ZIP archive.
  * @return integer The amount of files that were transfered from TAO to the ZIP archive within the method call.
  */
 public function addFile($src, $dest)
 {
     $zip = $this->getZip();
     return tao_helpers_File::addFilesToZip($zip, $src, $dest);
 }
开发者ID:oat-sa,项目名称:extension-tao-item,代码行数:14,代码来源:class.ItemExporter.php

示例2: exportCompiledDelivery

 /**
  * export a compiled delivery into an archive
  * 
  * @param core_kernel_classes_Resource $compiledDelivery
  * @throws Exception
  * @return string
  */
 public static function exportCompiledDelivery(core_kernel_classes_Resource $compiledDelivery)
 {
     $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');
     }
     $zipArchive = new ZipArchive();
     if ($zipArchive->open($path, ZipArchive::CREATE) !== true) {
         throw new Exception('Unable to create archive at ' . $path);
     }
     $taoDeliveryVersion = common_ext_ExtensionsManager::singleton()->getInstalledVersion('taoDelivery');
     $data = array('dir' => array(), 'label' => $compiledDelivery->getLabel(), 'version' => $taoDeliveryVersion);
     $directories = $compiledDelivery->getPropertyValues(new core_kernel_classes_Property(PROPERTY_COMPILEDDELIVERY_DIRECTORY));
     foreach ($directories as $id) {
         $directory = tao_models_classes_service_FileStorage::singleton()->getDirectoryById($id);
         tao_helpers_File::addFilesToZip($zipArchive, $directory->getPath(), $directory->getRelativePath());
         $data['dir'][$id] = $directory->getRelativePath();
     }
     $runtime = $compiledDelivery->getUniquePropertyValue(new core_kernel_classes_Property(PROPERTY_COMPILEDDELIVERY_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 common_Exception('Unable to add metadata to exported delivery assembly');
     }
     $data['meta'] = 'delivery.rdf';
     $content = json_encode($data);
     //'<?php return '.common_Utils::toPHPVariableString($data).";";
     if (!$zipArchive->addFromString(self::MANIFEST_FILE, $content)) {
         $zipArchive->close();
         unlink($path);
         throw common_Exception('Unable to add manifest to exported delivery assembly');
     }
     $zipArchive->close();
     return $path;
 }
开发者ID:swapnilaptara,项目名称:tao-aptara-assess,代码行数:45,代码来源:class.Assembler.php

示例3: recreatePackage

 public function recreatePackage($directory, $destination)
 {
     $zipArchive = new \ZipArchive();
     if ($zipArchive->open($destination, \ZipArchive::CREATE) !== TRUE) {
         throw new \common_Exception('Unable to create zipfile ' . $path);
     }
     \tao_helpers_File::addFilesToZip($zipArchive, $directory, DIRECTORY_SEPARATOR);
     $zipArchive->close();
 }
开发者ID:jbout,项目名称:boutTools,代码行数:9,代码来源:Obfuscate.php


注:本文中的tao_helpers_File::addFilesToZip方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。