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


PHP PharData::getPath方法代码示例

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


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

示例1: archiveExportFolder

 /**
  * Given the path to a Known export, creates a complete .tar.gz file and returns the path to that.
  * If $save_path is false, will save to the temporary folder.
  *
  * @param $path
  * @param $save_path
  * @return string
  */
 static function archiveExportFolder($path, $save_path = false)
 {
     if (!is_dir($path)) {
         return false;
     }
     if (substr($path, -1) != DIRECTORY_SEPARATOR) {
         $path .= DIRECTORY_SEPARATOR;
     }
     if (!file_exists($path . 'known.json')) {
         return false;
     }
     if (!class_exists('PharData')) {
         return false;
     }
     $filename = str_replace('.', '_', site()->config()->host);
     if (file_exists(site()->config()->getTempDir() . $filename . '.tar')) {
         @unlink(site()->config()->getTempDir() . $filename . '.tar');
         @unlink(site()->config()->getTempDir() . $filename . '.tar.gz');
     }
     $archive = new \PharData(site()->config()->getTempDir() . $filename . '.zip');
     $archive->buildFromDirectory($path);
     //$archive->compress(\Phar::GZ);
     return $archive->getPath();
 }
开发者ID:hank,项目名称:Known,代码行数:32,代码来源:Migration.php

示例2: build

 /**
  * Build docker image (Docker API v1.20)
  *
  * POST /build request returns empty body with different headers so it's not needed to build something
  * like UnexpectedStatusCodeException. We can get response success or fail only.
  *
  * @param array $options
  *   dockerfile - Path within the build context to the Dockerfile. This is ignored if remote is specified and points to an individual filename.
  *   t – A repository name (and optionally a tag) to apply to the resulting image in case of success.
  *   remote – A Git repository URI or HTTP/HTTPS URI build source. If the URI specifies a filename, the file’s contents are placed into a file called Dockerfile.
  *   q – Suppress verbose build output.
  *   nocache – Do not use the cache when building the image.
  *   pull - Attempt to pull the image even if an older image exists locally.
  *   rm - Remove intermediate containers after a successful build (default behavior).
  *   forcerm - Always remove intermediate containers (includes rm).
  *   memory - Set memory limit for build.
  *   memswap - Total memory (memory + swap), -1 to disable swap.
  *   cpushares - CPU shares (relative weight).
  *   cpusetcpus - CPUs in which to allow execution (e.g., 0-3, 0,1).
  *   cpuperiod - The length of a CPU period in microseconds.
  *   cpuquota - Microseconds of CPU time that the container can get in a CPU period
  *
  * @param $dockerfileString - Dockerfile contents
  * @param callable|null $callback
  * @return bool
  * @throws \GuzzleHttp\Exception\RequestException
  */
 public function build($dockerfileString, callable $callback = null, array $options = [])
 {
     if (null === $callback) {
         $callback = function () {
         };
     }
     // Create archive with Dockerfile content
     $phar = new \PharData(sys_get_temp_dir() . DIRECTORY_SEPARATOR . uniqid('docker_php_dockerfile_tmp_', true) . '.tar');
     $phar['Dockerfile'] = $dockerfileString;
     $dockerfileCompressed = $phar->compress(\Phar::GZ);
     $dockerfileResource = fopen($dockerfileCompressed->getPath(), 'r');
     // remove file from cache
     unlink($phar->getPath());
     unset($phar);
     $caughtException = null;
     try {
         $response = $this->client->post('/build?' . http_build_query($options), ['headers' => ['Content-Type' => 'application/tar'], 'body' => $dockerfileResource, 'callback' => $callback, 'wait' => true]);
         if ($response->getStatusCode() !== '200') {
             return false;
         }
     } catch (RequestException $e) {
         /** @var RequestException $caughtException */
         $caughtException = $e;
     }
     // remove second archive from cache
     unlink($dockerfileCompressed->getPath());
     unset($dockerfileCompressed);
     // this is try-finally replacement for current version php54
     if ($caughtException) {
         throw $caughtException;
     }
     return true;
 }
开发者ID:andreyserdjuk,项目名称:docker-php,代码行数:60,代码来源:ImageManager.php

示例3: downloadSensorML

 /**
  * get file content from id
  * @NoCSRFRequired
  * @PublicPage
  */
 public function downloadSensorML($uuid)
 {
     $systems = $this->systemMapper->getByUuid($uuid);
     if ($systems !== null) {
         $fileIds = array();
         $resultFiles = new \PharData(sys_get_temp_dir() . "/{$uuid}.zip");
         foreach ($systems as $system) {
             $fileId = $system->getFileId();
             if (!in_array($fileId, $fileIds)) {
                 $fileIds[] = $fileId;
                 $cacheInfo = FileCacheDao::getCacheInfo($fileId);
                 if ($cacheInfo !== null) {
                     $fileInfo = FileCacheDao::getFileInfo($cacheInfo['storage'], $cacheInfo['path'], $system->getPharPath());
                     $content = FileCacheDao::getContentByUrn($fileInfo['urn']);
                     $resultFiles->addFromString($uuid . "_" . $fileId . ".xml", $content);
                 }
             }
         }
         $fullPath = $resultFiles->getPath();
         if ($fd = fopen($fullPath, "r")) {
             $path_parts = pathinfo($fullPath);
             header("Content-type: application/octet-stream");
             header("Content-Disposition: filename=\"" . $path_parts["basename"] . "\"");
             while (!feof($fd)) {
                 $buffer = fread($fd, 2048);
                 echo $buffer;
             }
         }
         fclose($fd);
     }
     return new NotFoundResponse();
 }
开发者ID:ifremer,项目名称:snanny-owncloudapi,代码行数:37,代码来源:apicontroller.php


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