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


PHP Config::getConfigParam方法代码示例

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


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

示例1: execute

 public function execute($extName, $version = 'stable')
 {
     $logger = $this->getLogger();
     $extensions = array();
     if (Utils::startsWith($extName, '+')) {
         $config = Config::getConfigParam('extensions');
         $extName = ltrim($extName, '+');
         if (isset($config[$extName])) {
             foreach ($config[$extName] as $extensionName => $extOptions) {
                 $args = explode(' ', $extOptions);
                 $extensions[$extensionName] = $this->getExtData($args);
             }
         } else {
             $logger->info('Extension set name not found. Have you configured it at the config.yaml file?');
         }
     } else {
         $args = array_slice(func_get_args(), 1);
         $extensions[$extName] = $this->getExtData($args);
     }
     if ($this->options->{'php-version'} !== null) {
         $phpVersion = Utils::findLatestPhpVersion($this->options->{'php-version'});
         Config::setPhpVersion($phpVersion);
     }
     foreach ($extensions as $extensionName => $extData) {
         $extension = new Extension($extensionName, $logger);
         $extension->install($extData->version, $extData->options);
     }
     Config::useSystemPhpVersion();
 }
开发者ID:bensb,项目名称:phpbrew,代码行数:29,代码来源:InstallCommand.php

示例2: execute

 public function execute($extName, $version = 'stable')
 {
     if ((preg_match('#^git://#', $extName) || preg_match('#\\.git$#', $extName)) && !preg_match("#github|bitbucket#", $extName)) {
         $pathinfo = pathinfo($extName);
         $repoUrl = $extName;
         $extName = $pathinfo['filename'];
         $extDir = Config::getBuildDir() . DIRECTORY_SEPARATOR . Config::getCurrentPhpName() . DIRECTORY_SEPARATOR . 'ext' . DIRECTORY_SEPARATOR . $extName;
         if (!file_exists($extDir)) {
             passthru("git clone {$repoUrl} {$extDir}", $ret);
             if ($ret != 0) {
                 return $this->logger->error('Clone failed.');
             }
         }
     }
     $extensions = array();
     if (Utils::startsWith($extName, '+')) {
         $config = Config::getConfigParam('extensions');
         $extName = ltrim($extName, '+');
         if (isset($config[$extName])) {
             foreach ($config[$extName] as $extensionName => $extOptions) {
                 $args = explode(' ', $extOptions);
                 $extensions[$extensionName] = $this->getExtConfig($args);
             }
         } else {
             $this->logger->info('Extension set name not found. Have you configured it at the config.yaml file?');
         }
     } else {
         $args = array_slice(func_get_args(), 1);
         $extensions[$extName] = $this->getExtConfig($args);
     }
     $extensionList = new ExtensionList();
     $manager = new ExtensionManager($this->logger);
     foreach ($extensions as $extensionName => $extConfig) {
         $provider = $extensionList->exists($extensionName);
         if (!$provider) {
             throw new Exception("Could not find provider for {$extensionName}.");
         }
         $extensionName = $provider->getPackageName();
         $ext = ExtensionFactory::lookupRecursive($extensionName);
         $always_redownload = $this->options->{'pecl'} || $this->options->{'redownload'} || !$provider->isBundled($extensionName);
         // Extension not found, use pecl to download it.
         if (!$ext || $always_redownload) {
             // not every project has stable branch, using master as default version
             $args = array_slice(func_get_args(), 1);
             if (!isset($args[0]) || $args[0] != $extConfig->version) {
                 $extConfig->version = $provider->getDefaultVersion();
             }
             $extensionDownloader = new ExtensionDownloader($this->logger, $this->options);
             $extensionDownloader->download($provider, $extConfig->version);
             // Reload the extension
             if ($provider->shouldLookupRecursive()) {
                 $ext = ExtensionFactory::lookupRecursive($extensionName);
             } else {
                 $ext = ExtensionFactory::lookup($extensionName);
             }
             if ($ext) {
                 $extensionDownloader->renameSourceDirectory($ext);
             }
         }
         if (!$ext) {
             throw new Exception("{$extensionName} not found.");
         }
         $manager->installExtension($ext, $extConfig->options);
     }
 }
开发者ID:WebDevJL,项目名称:phpbrew,代码行数:65,代码来源:InstallCommand.php

示例3: build

 /**
  * Build variants to configure options from php build object.
  *
  * @param Build $build The build object, contains version information
  *
  * @return array|void
  * @throws \Exception
  */
 public function build(Build $build)
 {
     $customVirtualVariants = Config::getConfigParam('variants');
     foreach (array_keys($build->getVariants()) as $variantName) {
         if (isset($customVirtualVariants[$variantName])) {
             foreach ($customVirtualVariants[$variantName] as $lib => $params) {
                 if (is_array($params)) {
                     $this->variants[$lib] = $params;
                 }
             }
         }
     }
     // reset builtList
     $this->builtList = array();
     // reset built options
     if ($build->hasVariant('all') || $build->hasVariant('neutral')) {
         $this->options = array();
     } else {
         // build common options
         $this->options = array('--disable-all', '--enable-phar', '--enable-session', '--enable-short-tags', '--enable-tokenizer', '--with-pcre-regex');
         if ($prefix = Utils::findIncludePrefix('zlib.h')) {
             $this->addOptions('--with-zlib=' . $prefix);
         }
     }
     if ($prefix = Utils::findLibPrefix('x86_64-linux-gnu')) {
         $this->addOptions("--with-libdir=lib/x86_64-linux-gnu");
     } elseif ($prefix = Utils::findLibPrefix('i386-linux-gnu')) {
         $this->addOptions("--with-libdir=lib/i386-linux-gnu");
     }
     // enable/expand virtual variants
     foreach ($this->virtualVariants as $name => $variantNames) {
         if ($build->isEnabledVariant($name)) {
             foreach ($variantNames as $subVariantName) {
                 // enable the sub-variant only if it's not already enabled
                 // in order to not override a non-default value with the default
                 if (!$build->isEnabledVariant($subVariantName)) {
                     $build->enableVariant($subVariantName);
                 }
             }
             // it's a virtual variant, can not be built by buildVariant
             // method.
             $build->removeVariant($name);
         }
     }
     // Remove these enabled variant for disabled variants.
     $build->resolveVariants();
     // before we build these options from variants,
     // we need to check the enabled and disabled variants
     $this->checkConflicts($build);
     foreach ($build->getVariants() as $feature => $userValue) {
         if ($options = $this->buildVariant($build, $feature, $userValue)) {
             $this->addOptions($options);
         }
     }
     foreach ($build->getDisabledVariants() as $feature => $true) {
         if ($options = $this->buildDisableVariant($build, $feature)) {
             $this->addOptions($options);
         }
     }
     /*
     $opts = array_merge( $opts ,
         $this->getVersionSpecificOptions($version) );
     */
     $options = array_merge(array(), $this->options);
     // reset options
     $this->options = array();
     return $options;
 }
开发者ID:m-jch,项目名称:phpbrew,代码行数:76,代码来源:VariantBuilder.php

示例4: execute

 public function execute($extName, $version = 'stable')
 {
     if (version_compare(PHP_VERSION, '7.0.0') > 0) {
         $this->logger->warn("Warning: Some extension won't be able to be built with php7. If the extension\nsupports php7 in another branch or new major version, you will need to specify\nthe branch name or version name explicitly.\n\nFor example, to install memcached extension for php7, use:\n\n    phpbrew ext install github:php-memcached-dev/php-memcached php7 -- --disable-memcached-sasl\n");
     }
     if (strtolower($extName) === 'apc' && version_compare(PHP_VERSION, '5.6.0') > 0) {
         $this->logger->warn('apc is not compatible with php 5.6+ versions, install apcu instead.');
     }
     // Detect protocol
     if ((preg_match('#^git://#', $extName) || preg_match('#\\.git$#', $extName)) && !preg_match('#github|bitbucket#', $extName)) {
         $pathinfo = pathinfo($extName);
         $repoUrl = $extName;
         $extName = $pathinfo['filename'];
         $extDir = Config::getBuildDir() . DIRECTORY_SEPARATOR . Config::getCurrentPhpName() . DIRECTORY_SEPARATOR . 'ext' . DIRECTORY_SEPARATOR . $extName;
         if (!file_exists($extDir)) {
             passthru("git clone {$repoUrl} {$extDir}", $ret);
             if ($ret != 0) {
                 return $this->logger->error('Clone failed.');
             }
         }
     }
     // Expand extensionset from config
     $extensions = array();
     if (Utils::startsWith($extName, '+')) {
         $config = Config::getConfigParam('extensions');
         $extName = ltrim($extName, '+');
         if (isset($config[$extName])) {
             foreach ($config[$extName] as $extensionName => $extOptions) {
                 $args = explode(' ', $extOptions);
                 $extensions[$extensionName] = $this->getExtConfig($args);
             }
         } else {
             $this->logger->info('Extension set name not found. Have you configured it at the config.yaml file?');
         }
     } else {
         $args = array_slice(func_get_args(), 1);
         $extensions[$extName] = $this->getExtConfig($args);
     }
     $extensionList = new ExtensionList($this->logger, $this->options);
     $manager = new ExtensionManager($this->logger);
     foreach ($extensions as $extensionName => $extConfig) {
         $provider = $extensionList->exists($extensionName);
         if (!$provider) {
             throw new Exception("Could not find provider for {$extensionName}.");
         }
         $extensionName = $provider->getPackageName();
         $ext = ExtensionFactory::lookupRecursive($extensionName);
         $always_redownload = $this->options->{'pecl'} || $this->options->{'redownload'} || !$provider->isBundled($extensionName);
         // Extension not found, use pecl to download it.
         if (!$ext || $always_redownload) {
             // not every project has stable branch, using master as default version
             $args = array_slice(func_get_args(), 1);
             if (!isset($args[0]) || $args[0] != $extConfig->version) {
                 $extConfig->version = $provider->getDefaultVersion();
             }
             $extensionDownloader = new ExtensionDownloader($this->logger, $this->options);
             $extensionDownloader->download($provider, $extConfig->version);
             // Reload the extension
             if ($provider->shouldLookupRecursive()) {
                 $ext = ExtensionFactory::lookupRecursive($extensionName);
             } else {
                 $ext = ExtensionFactory::lookup($extensionName);
             }
             if ($ext) {
                 $extensionDownloader->renameSourceDirectory($ext);
             }
         }
         if (!$ext) {
             throw new Exception("{$extensionName} not found.");
         }
         $manager->installExtension($ext, $extConfig->options);
     }
 }
开发者ID:phpbrew,项目名称:phpbrew,代码行数:73,代码来源:InstallCommand.php


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