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


PHP Config::getTempFileDir方法代码示例

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


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

示例1: testDownloadByCurlCommand

 public function testDownloadByCurlCommand()
 {
     $downloader = new UrlDownloaderForTest($this->logger, new OptionResult());
     $downloader->setIsCurlCommandAvailable(true);
     $actualFilePath = tempnam(Config::getTempFileDir(), '');
     $downloader->download('http://httpbin.org/', $actualFilePath);
     $this->assertTrue($downloader->isCurlCommandAvailable());
     $this->assertFileExists($actualFilePath);
 }
开发者ID:nanasess,项目名称:phpbrew,代码行数:9,代码来源:UrlDownloaderTest.php

示例2: _test

 private function _test($downloader)
 {
     $instance = DownloadFactory::getInstance($this->logger, new OptionResult(), $downloader);
     if ($instance->hasSupport(false)) {
         $actualFilePath = tempnam(Config::getTempFileDir(), '');
         $instance->download('http://httpbin.org/', $actualFilePath);
         $this->assertFileExists($actualFilePath);
     } else {
         $this->markTestSkipped();
     }
 }
开发者ID:phpbrew,项目名称:phpbrew,代码行数:11,代码来源:DownloaderTest.php

示例3: extract

 /**
  * Unpacks the source tarball file.
  *
  * @param string $targetFilePath absolute file path
  */
 public function extract(Build $build, $targetFilePath, $extractDir = NULL)
 {
     $extractDirTemp = Config::getTempFileDir();
     if (!$extractDir) {
         $extractDir = dirname($targetFilePath);
     }
     $extractedDirTemp = $extractDirTemp . DIRECTORY_SEPARATOR . preg_replace('#\\.tar\\.(gz|bz2)$#', '', basename($targetFilePath));
     $extractedDir = $extractDir . DIRECTORY_SEPARATOR . $build->getName();
     if ($build->getState() >= Build::STATE_EXTRACT && file_exists($extractedDir . DIRECTORY_SEPARATOR . 'configure')) {
         $this->info("===> Distribution file was successfully extracted, skipping...");
         return $extractedDir;
     }
     // NOTICE: Always extract to prevent incomplete extraction
     $this->info("===> Extracting {$targetFilePath} to {$extractedDirTemp}");
     system("tar -C {$extractDirTemp} -xf {$targetFilePath}", $ret);
     if ($ret != 0) {
         throw new RuntimeException('Extract failed.');
     }
     clearstatcache(true);
     if (!is_dir($extractedDirTemp)) {
         // retry with github extracted dir path
         $extractedDirTemp = $extractDirTemp . DIRECTORY_SEPARATOR . 'php-src-' . preg_replace('#\\.tar\\.(gz|bz2)$#', '', basename($targetFilePath));
         if (!is_dir($extractedDirTemp)) {
             throw new RuntimeException("Unable to find {$extractedDirTemp}");
         }
     }
     if (is_dir($extractedDir)) {
         $this->info("===> Removing {$extractedDir}");
         system("rm -rf {$extractedDir}", $ret);
         if ($ret !== 0) {
             throw new RuntimeException("Unable to remove {$extractedDir}.");
         }
     }
     $this->info("===> Moving {$extractedDirTemp} to {$extractedDir}");
     if (!rename($extractedDirTemp, $extractedDir)) {
         throw new RuntimeException("Unable to move {$extractedDirTemp} to {$extractedDir}");
     }
     $build->setState(Build::STATE_EXTRACT);
     return $extractedDir;
     /*
      * XXX: unless we have a fast way to verify the extraction.
     if ($this->options->force || ! file_exists($extractedDir . DIRECTORY_SEPARATOR . 'configure')) {
         $this->info("===> Extracting $targetFilePath...");
         system("tar -C $dir -xjf $targetFilePath", $ret);
         if ($ret != 0) {
             die('Extract failed.');
         }
     } else {
         $this->info("Found existing $extractedDir, Skip extracting.");
     }
     */
 }
开发者ID:WebDevJL,项目名称:phpbrew,代码行数:57,代码来源:ExtractTask.php

示例4: __construct

 /**
  * $caller must be a subclass of PHPUnit_Framework_TestCase.
  * @param Object $caller the object which creates this object.
  * @param string $sourcePath the path of a source file.
  */
 public function __construct($caller, $sourcePath)
 {
     $this->caller = $caller;
     $this->sourcePath = $sourcePath;
     $this->temporaryDirectory = Config::getTempFileDir();
 }
开发者ID:WebDevJL,项目名称:phpbrew,代码行数:11,代码来源:TemporaryFileFixture.php

示例5: __construct

 public function __construct()
 {
     parent::__construct('5.3.29');
     $this->setSourceDirectory(Config::getTempFileDir() . '/' . uniqid());
 }
开发者ID:WebDevJL,项目名称:phpbrew,代码行数:5,代码来源:Patch64BitSupportTaskTest.php


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