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


PHP PhpBrew\Config类代码示例

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


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

示例1: execute

 public function execute()
 {
     $versions = Config::getInstalledPhpVersions();
     $currentVersion = Config::getCurrentPhpName();
     if (empty($versions)) {
         return $this->logger->notice("Please install at least one PHP with your prefered version.");
     }
     if ($currentVersion === false or !in_array($currentVersion, $versions)) {
         $this->logger->writeln("* (system)");
     }
     foreach ($versions as $version) {
         $versionPrefix = Config::getVersionInstallPrefix($version);
         if ($currentVersion == $version) {
             $this->logger->writeln($this->formatter->format(sprintf('* %-15s', $version), 'bold'));
         } else {
             $this->logger->writeln($this->formatter->format(sprintf('  %-15s', $version), 'bold'));
         }
         if ($this->options->dir) {
             $this->logger->writeln(sprintf("    Prefix:   %s", $versionPrefix));
         }
         // TODO: use Build class to get the variants
         if ($this->options->variants && file_exists($versionPrefix . DIRECTORY_SEPARATOR . 'phpbrew.variants')) {
             $info = unserialize(file_get_contents($versionPrefix . DIRECTORY_SEPARATOR . 'phpbrew.variants'));
             echo "    Variants: ";
             echo wordwrap(VariantParser::revealCommandArguments($info), 75, " \\\n              ");
             echo "\n";
         }
     }
 }
开发者ID:WebDevJL,项目名称:phpbrew,代码行数:29,代码来源:ListCommand.php

示例2: execute

 public function execute($version)
 {
     $version = preg_replace('/^php-/', '', $version);
     $releaseList = ReleaseList::getReadyInstance($this->options);
     $releases = $releaseList->getReleases();
     $versionInfo = $releaseList->getVersion($version);
     if (!$versionInfo) {
         throw new Exception("Version {$version} not found.");
     }
     $version = $versionInfo['version'];
     $distUrl = 'http://www.php.net/get/' . $versionInfo['filename'] . '/from/this/mirror';
     if ($mirrorSite = $this->options->mirror) {
         // http://tw1.php.net/distributions/php-5.3.29.tar.bz2
         $distUrl = $mirrorSite . '/distributions/' . $versionInfo['filename'];
     }
     $prepare = new PrepareDirectoryTask($this->logger, $this->options);
     $prepare->run();
     $distFileDir = Config::getDistFileDir();
     $download = new DownloadTask($this->logger, $this->options);
     $targetDir = $download->download($distUrl, $distFileDir, $versionInfo['md5']);
     if (!file_exists($targetDir)) {
         throw new Exception('Download failed.');
     }
     $this->logger->info("Done, please look at: {$targetDir}");
 }
开发者ID:phpbrew,项目名称:phpbrew,代码行数:25,代码来源:DownloadCommand.php

示例3: execute

 public function execute()
 {
     $root = Config::getPhpbrewRoot();
     $php = Config::getCurrentPhpName();
     $file = "{$root}/php/{$php}/etc/php.ini";
     Utils::editor($file);
 }
开发者ID:nanasess,项目名称:phpbrew,代码行数:7,代码来源:ConfigCommand.php

示例4: getVersions

 protected function getVersions()
 {
     $versions = Config::getInstalledPhpVersions();
     return array_map(function ($version) {
         return str_replace('php-', '', $version);
     }, $versions);
 }
开发者ID:WebDevJL,项目名称:phpbrew,代码行数:7,代码来源:EachCommand.php

示例5: 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

示例6: execute

 public function execute()
 {
     $releaseList = new ReleaseList();
     $releases = array();
     //always fetch list from remote when --old presents, because the local file may not contain the old versions
     // and --old is seldom used.
     if (!$releaseList->foundLocalReleaseList() || $this->options->update || $this->options->old) {
         $fetchTask = new FetchReleaseListTask($this->logger, $this->options);
         $releases = $fetchTask->fetch();
     } else {
         $this->logger->info(sprintf('Read local release list (last update: %s UTC).', gmdate('Y-m-d H:i:s', filectime(Config::getPHPReleaseListPath()))));
         $releases = $releaseList->loadLocalReleaseList();
         $this->logger->info('You can run `phpbrew update` or `phpbrew known --update` to get a newer release list.');
     }
     foreach ($releases as $majorVersion => $versions) {
         if (version_compare($majorVersion, '5.2', 'le') && !$this->options->old) {
             continue;
         }
         $versionList = array_keys($versions);
         if (!$this->options->more) {
             array_splice($versionList, 8);
         }
         $this->logger->writeln($this->formatter->format("{$majorVersion}: ", 'yellow') . wordwrap(implode(', ', $versionList), 80, "\n" . str_repeat(' ', 5)) . (!$this->options->more ? ' ...' : ''));
     }
     if ($this->options->old) {
         $this->logger->warn('phpbrew need php 5.3 or above to run. build/switch to versions below 5.3 at your own risk.');
     }
 }
开发者ID:phpbrew,项目名称:phpbrew,代码行数:28,代码来源:KnownCommand.php

示例7: execute

 public function execute()
 {
     $args = func_get_args();
     // $currentVersion;
     $root = Config::getPhpbrewRoot();
     $home = Config::getPhpbrewHome();
     $buildDir = Config::getBuildDir();
     $version = getenv('PHPBREW_PHP');
     // XXX: get source dir from current build information
     $sourceDir = $buildDir . DIRECTORY_SEPARATOR . $version;
     $this->logger->info($sourceDir);
     $cmd = new CommandBuilder('ctags');
     $cmd->arg('--recurse');
     $cmd->arg('-a');
     $cmd->arg('-h');
     $cmd->arg('.c.h.cpp');
     $cmd->arg($sourceDir . DIRECTORY_SEPARATOR . 'main');
     $cmd->arg($sourceDir . DIRECTORY_SEPARATOR . 'ext');
     $cmd->arg($sourceDir . DIRECTORY_SEPARATOR . 'Zend');
     foreach ($args as $a) {
         $cmd->arg($a);
     }
     $this->logger->info($cmd->__toString());
     $cmd->execute();
     $this->logger->info("Done");
 }
开发者ID:bensb,项目名称:phpbrew,代码行数:26,代码来源:CtagsCommand.php

示例8: execute

 public function execute($version = null)
 {
     // get current version
     if (!$version) {
         $version = getenv('PHPBREW_PHP');
     }
     // $currentVersion;
     $root = Config::getPhpbrewRoot();
     $home = Config::getPhpbrewHome();
     $lookup = getenv('PHPBREW_LOOKUP_PREFIX');
     // $versionBuildPrefix = Config::getVersionBuildPrefix($version);
     // $versionBinPath     = Config::getVersionBinPath($version);
     echo "export PHPBREW_ROOT={$root}\n";
     echo "export PHPBREW_HOME={$home}\n";
     echo "export PHPBREW_LOOKUP_PREFIX={$lookup}\n";
     if ($version !== false) {
         // checking php version exists
         $version = Utils::findLatestPhpVersion($version);
         $targetPhpBinPath = Config::getVersionBinPath($version);
         if (!is_dir($targetPhpBinPath)) {
             throw new Exception("# php version: " . $version . " not exists.");
         }
         echo 'export PHPBREW_PHP=' . $version . "\n";
         echo 'export PHPBREW_PATH=' . ($version ? Config::getVersionBinPath($version) : '') . "\n";
     }
 }
开发者ID:bensb,项目名称:phpbrew,代码行数:26,代码来源:EnvCommand.php

示例9: arguments

 public function arguments($args)
 {
     $args->add('extensions')->suggestions(function () {
         return array_map(function ($path) {
             return basename(basename($path, '.disabled'), '.ini');
         }, glob(Config::getCurrentPhpDir() . '/var/db/*.{ini,disabled}', GLOB_BRACE));
     });
 }
开发者ID:phpbrew,项目名称:phpbrew,代码行数:8,代码来源:ConfigCommand.php

示例10: __construct

 public function __construct()
 {
     $this->root = Config::getPhpbrewRoot();
     $this->baseDir = $this->root . DIRECTORY_SEPARATOR . 'register';
     if (!file_exists($this->baseDir)) {
         mkdir($this->baseDir, 0755, true);
     }
 }
开发者ID:hechunwen,项目名称:phpbrew,代码行数:8,代码来源:BuildRegister.php

示例11: arguments

 public function arguments($args)
 {
     $args->add('extensions')->suggestions(function () {
         $extension = '.ini.disabled';
         return array_map(function ($path) use($extension) {
             return basename($path, $extension);
         }, glob(Config::getCurrentPhpDir() . "/var/db/*{$extension}"));
     });
 }
开发者ID:WebDevJL,项目名称:phpbrew,代码行数:9,代码来源:EnableCommand.php

示例12: 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

示例13: install

 public function install(Extension $ext, array $configureOptions = array())
 {
     $sourceDir = $ext->getSourceDirectory();
     $pwd = getcwd();
     $buildLogPath = $sourceDir . DIRECTORY_SEPARATOR . 'build.log';
     $make = new MakeTask($this->logger, $this->options);
     $make->setBuildLogPath($buildLogPath);
     $this->logger->info("Log stored at: {$buildLogPath}");
     $this->logger->info("Changing directory to {$sourceDir}");
     chdir($sourceDir);
     if (!$this->options->{'no-clean'} && $ext->isBuildable()) {
         $clean = new MakeTask($this->logger, $this->options);
         $clean->setQuiet();
         $clean->clean($ext);
     }
     if ($ext->getConfigM4File() !== "config.m4" && !file_exists($sourceDir . DIRECTORY_SEPARATOR . 'config.m4')) {
         symlink($ext->getConfigM4File(), $sourceDir . DIRECTORY_SEPARATOR . 'config.m4');
     }
     // If the php version is specified, we should get phpize with the correct version.
     $this->logger->info('===> Phpize...');
     Utils::system("phpize > {$buildLogPath} 2>&1", $this->logger);
     // here we don't want to use closure, because
     // 5.2 does not support closure. We haven't decided whether to
     // support 5.2 yet.
     $escapeOptions = array_map('escapeshellarg', $configureOptions);
     $this->logger->info("===> Configuring...");
     $phpConfig = Config::getCurrentPhpConfigBin();
     if (file_exists($phpConfig)) {
         $this->logger->debug("Appending argument: --with-php-config={$phpConfig}");
         $escapeOptions[] = '--with-php-config=' . $phpConfig;
     }
     // Utils::system('./configure ' . join(' ', $escapeOptions) . ' >> build.log 2>&1');
     $cmd = './configure ' . join(' ', $escapeOptions);
     if (!$this->logger->isDebug()) {
         $cmd .= " >> {$buildLogPath} 2>&1";
     }
     Utils::system($cmd, $this->logger);
     $this->logger->info("===> Building...");
     if ($this->logger->isDebug()) {
         passthru('make');
     } else {
         $make->run($ext);
     }
     $this->logger->info("===> Installing...");
     // This function is disabled when PHP is running in safe mode.
     if ($this->logger->isDebug()) {
         passthru('make install');
     } else {
         $make->install($ext);
     }
     // TODO: use getSharedLibraryPath()
     $this->logger->debug("Installed extension library: " . $ext->getSharedLibraryPath());
     // Try to find the installed path by pattern
     // Installing shared extensions: /Users/c9s/.phpbrew/php/php-5.4.10/lib/php/extensions/debug-non-zts-20100525/
     chdir($pwd);
     $this->logger->info("===> Extension is installed.");
 }
开发者ID:WebDevJL,项目名称:phpbrew,代码行数:57,代码来源:ExtensionInstaller.php

示例14: arguments

 public function arguments($args)
 {
     $args->add('extensions')->suggestions(function () {
         $extdir = Config::getBuildDir() . '/' . Config::getCurrentPhpName() . '/ext';
         return array_filter(scandir($extdir), function ($d) use($extdir) {
             return $d != '.' && $d != '..' && is_dir($extdir . DIRECTORY_SEPARATOR . $d);
         });
     });
 }
开发者ID:phpbrew,项目名称:phpbrew,代码行数:9,代码来源:CleanCommand.php

示例15: execute

 public function execute()
 {
     $file = php_ini_loaded_file();
     if (!file_exists($file)) {
         $php = Config::getCurrentPhpName();
         $this->logger->warn("Sorry, I can't find the {$file} file for php {$php}.");
         return;
     }
     Utils::editor($file);
 }
开发者ID:phpbrew,项目名称:phpbrew,代码行数:10,代码来源:ConfigCommand.php


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