當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。