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


PHP Config::getCacheDir方法代码示例

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


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

示例1: run

 public function run(Build $build, $variantOptions)
 {
     $extra = $build->getExtraOptions();
     $prefix = $build->getInstallPrefix();
     // append cflags
     if ($this->optimizationLevel) {
         $o = $this->optimizationLevel;
         $cflags = getenv('CFLAGS');
         putenv("CFLAGS={$cflags} -O{$o}");
         $_ENV['CFLAGS'] = "{$cflags} -O{$o}";
     }
     $args = array();
     if (!$this->options->{'no-config-cache'}) {
         // $args[] = "-C"; // project wise cache (--config-cache)
         $args[] = '--cache-file=' . escapeshellarg(Config::getCacheDir() . DIRECTORY_SEPARATOR . 'config.cache');
     }
     $args[] = '--prefix=' . $prefix;
     if ($this->options->{'user-config'}) {
         $args[] = "--with-config-file-path={$prefix}/etc";
         $args[] = "--with-config-file-scan-dir={$prefix}/var/db";
     } else {
         $args[] = "--with-config-file-path={$prefix}/etc";
         $args[] = "--with-config-file-scan-dir={$prefix}/var/db";
     }
     if ($variantOptions) {
         $args = array_merge($args, $variantOptions);
     }
     $this->debug('Enabled variants: [' . implode(', ', array_keys($build->getVariants())) . ']');
     $this->debug('Disabled variants: [' . implode(', ', array_keys($build->getDisabledVariants())) . ']');
     // todo: move to pear variant
     $args[] = "--with-pear={$prefix}/lib/php";
     // Options for specific versions
     // todo: extract to BuildPlan class: PHP53 BuildPlan, PHP54 BuildPlan, PHP55 BuildPlan ?
     if ($build->compareVersion('5.4') == -1) {
         // copied from https://github.com/Homebrew/homebrew-php/blob/master/Formula/php53.rb
         $args[] = '--enable-sqlite-utf8';
         $args[] = '--enable-zend-multibyte';
     } elseif ($build->compareVersion('5.6') == -1) {
         $args[] = '--enable-zend-signals';
     }
     foreach ($extra as $a) {
         $args[] = $a;
     }
     $cmd = new CommandBuilder('./configure');
     $cmd->args($args);
     $buildLogPath = $build->getBuildLogPath();
     if (file_exists($buildLogPath)) {
         $newPath = $buildLogPath . '.' . filemtime($buildLogPath);
         $this->info("Found existing build.log, renaming it to {$newPath}");
         rename($buildLogPath, $newPath);
     }
     $this->info("===> Configuring {$build->version}...");
     $cmd->setAppendLog(true);
     $cmd->setLogPath($buildLogPath);
     $cmd->setStdout($this->options->{'stdout'});
     if (!$this->options->{'stdout'}) {
         $this->logger->info("\n");
         $this->logger->info("Use tail command to see what's going on:");
         $this->logger->info("   \$ tail -F {$buildLogPath}\n\n");
     }
     $this->debug($cmd->buildCommand());
     if ($this->options->nice) {
         $cmd->nice($this->options->nice);
     }
     if (!$this->options->dryrun) {
         $code = $cmd->execute($lastline);
         if ($code !== 0) {
             throw new SystemCommandException("Configure failed: {$lastline}", $build, $buildLogPath);
         }
     }
     $build->setState(Build::STATE_CONFIGURE);
 }
开发者ID:phpbrew,项目名称:phpbrew,代码行数:72,代码来源:ConfigureTask.php


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