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


PHP Config::getCurrentPhpName方法代码示例

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


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

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

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

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

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

示例5: purgeExtension

 public function purgeExtension(Extension $ext)
 {
     if ($sourceDir = $ext->getSourceDirectory()) {
         $currentPhpExtensionDirectory = Config::getBuildDir() . '/' . Config::getCurrentPhpName() . '/ext';
         $extName = $ext->getExtensionName();
         $extensionDir = $currentPhpExtensionDirectory . DIRECTORY_SEPARATOR . $extName;
         if (file_exists($extensionDir)) {
             Utils::system("rm -rvf {$extensionDir}");
         }
     }
 }
开发者ID:WebDevJL,项目名称:phpbrew,代码行数:11,代码来源:ExtensionManager.php

示例6: execute

 public function execute()
 {
     if ($this->options->{'php'} !== null) {
         $php = Utils::findLatestPhpVersion($this->options->{'php'});
     } else {
         $php = Config::getCurrentPhpName();
     }
     $buildDir = Config::getBuildDir();
     $extDir = $buildDir . DIRECTORY_SEPARATOR . $php . DIRECTORY_SEPARATOR . 'ext';
     // listing all local extensions
     if (version_compare('php-' . phpversion(), $php, '==')) {
         $loaded = array_map('strtolower', get_loaded_extensions());
     } else {
         $this->logger->info('PHP version is different from current active version.');
         $this->logger->info('Only available extensions are listed.');
         $this->logger->info('You will not see which of them are loaded.');
         $loaded = array();
     }
     // list for extensions which are not enabled
     $extensions = array();
     if (is_dir($extDir)) {
         $fp = opendir($extDir);
         if ($fp !== false) {
             while ($file = readdir($fp)) {
                 if ($file === '.' || $file === '..') {
                     continue;
                 }
                 if (is_file($extDir . '/' . $file)) {
                     continue;
                 }
                 $n = strtolower(preg_replace('#-[\\d\\.]+$#', '', $file));
                 if (in_array($n, $loaded)) {
                     continue;
                 }
                 $extensions[] = $n;
             }
             sort($loaded);
             sort($extensions);
             closedir($fp);
         }
     }
     $this->logger->info('Loaded extensions:');
     foreach ($loaded as $ext) {
         $this->logger->info("  [*] {$ext}");
     }
     $this->logger->info('Available extensions:');
     foreach ($extensions as $ext) {
         $this->logger->info("  [ ] {$ext}");
     }
 }
开发者ID:bensb,项目名称:phpbrew,代码行数:50,代码来源:ExtCommand.php

示例7: renameSourceDirectory

 public function renameSourceDirectory(Extension $ext)
 {
     $currentPhpExtensionDirectory = Config::getBuildDir() . '/' . Config::getCurrentPhpName() . '/ext';
     $extName = $ext->getExtensionName();
     $name = $ext->getName();
     $extensionDir = $currentPhpExtensionDirectory . DIRECTORY_SEPARATOR . $extName;
     $extensionExtractDir = $currentPhpExtensionDirectory . DIRECTORY_SEPARATOR . $name;
     if ($name != $extName) {
         $this->logger->info("===> Rename source directory to {$extensionDir}...");
         $cmds = array("rm -rf {$extensionDir}", "mv {$extensionExtractDir} {$extensionDir}");
         foreach ($cmds as $cmd) {
             $this->logger->debug($cmd);
             Utils::system($cmd);
         }
         // replace source directory to new source directory
         $sourceDir = str_replace($extensionExtractDir, $extensionDir, $ext->getSourceDirectory());
         $ext->setSourceDirectory($sourceDir);
         $ext->setName($extName);
     }
 }
开发者ID:nanasess,项目名称:phpbrew,代码行数:20,代码来源:ExtensionDownloader.php

示例8: execute

 public function execute($name)
 {
     switch ($name) {
         case 'home':
             echo Config::getPhpbrewRoot();
             break;
         case 'build':
             echo Config::getBuildDir();
             break;
         case 'bin':
             echo Config::getCurrentPhpBin();
             break;
         case 'include':
             echo Config::getVersionBuildPrefix(Config::getCurrentPhpName()) . DIRECTORY_SEPARATOR . 'include';
             break;
         case 'etc':
             echo Config::getVersionBuildPrefix(Config::getCurrentPhpName()) . DIRECTORY_SEPARATOR . 'etc';
             break;
     }
 }
开发者ID:bensb,项目名称:phpbrew,代码行数:20,代码来源:PathCommand.php

示例9: execute

 public function execute()
 {
     $versions = Config::getInstalledPhpVersions();
     $currentVersion = Config::getCurrentPhpName();
     // var_dump( $versions );
     echo "Installed versions:\n";
     if ($currentVersion === false or in_array($currentVersion, $versions) === false) {
         echo "* (system)\n";
     }
     foreach ($versions as $version) {
         $versionPrefix = Config::getVersionBuildPrefix($version);
         printf('  %-15s  (%-10s)', $version, $versionPrefix);
         if (file_exists($versionPrefix . DIRECTORY_SEPARATOR . 'phpbrew.variants')) {
             $info = unserialize(file_get_contents($versionPrefix . DIRECTORY_SEPARATOR . 'phpbrew.variants'));
             echo "\n";
             echo str_repeat(' ', 19);
             echo VariantParser::revealCommandArguments($info);
         }
         echo "\n";
     }
 }
开发者ID:bensb,项目名称:phpbrew,代码行数:21,代码来源:ListCommand.php

示例10: setup

 public function setup($options)
 {
     $phpConfigFile = $options->production ? 'php.ini-production' : 'php.ini-development';
     $this->logger->info("---> Copying config file for " . $options->production ? 'production' : 'development');
     if (file_exists($phpConfigFile)) {
         $this->logger->info("Found config file: {$phpConfigFile}");
         $version = Config::getCurrentPhpName();
         if (!file_exists(Config::getVersionEtcPath($version))) {
             $dir = Config::getVersionEtcPath($version);
             $this->logger->debug("Creating config directory");
             mkdir($dir, 0755, true);
         }
         $targetConfigPath = Config::getVersionEtcPath($version) . DIRECTORY_SEPARATOR . 'php.ini';
         if (file_exists($targetConfigPath)) {
             $this->logger->notice("{$targetConfigPath} exists, do not overwrite.");
         } else {
             // TODO: Move this to PhpConfigPatchTask
             // move config file to target location
             copy($phpConfigFile, $targetConfigPath);
             // replace current timezone
             $timezone = ini_get('date.timezone');
             $pharReadonly = ini_get('phar.readonly');
             if ($timezone || $pharReadonly) {
                 // patch default config
                 $content = file_get_contents($targetConfigPath);
                 if ($timezone) {
                     $this->logger->info("---> Found date.timezone, patch config timezone with {$timezone}");
                     $content = preg_replace('/^date.timezone\\s*=\\s*.*/im', "date.timezone = {$timezone}", $content);
                 }
                 if (!$pharReadonly) {
                     $this->logger->info("---> Disable phar.readonly option.");
                     $content = preg_replace('/^phar.readonly\\s*=\\s*.*/im', "phar.readonly = 0", $content);
                 }
                 file_put_contents($targetConfigPath, $content);
             }
         }
     }
 }
开发者ID:WebDevJL,项目名称:phpbrew,代码行数:38,代码来源:DefaultConfigTask.php

示例11: execute

 public function execute($name)
 {
     switch ($name) {
         case 'root':
             echo Config::getRoot();
             break;
         case 'home':
             echo Config::getHome();
             break;
         case 'config-scan':
             echo Config::getCurrentPhpConfigScanPath();
             break;
         case 'dist':
             echo Config::getDistFileDir();
             break;
         case 'build':
             echo Config::getCurrentBuildDir();
             break;
         case 'bin':
             echo Config::getCurrentPhpBin();
             break;
         case 'include':
             echo Config::getVersionInstallPrefix(Config::getCurrentPhpName()) . DIRECTORY_SEPARATOR . 'include';
             break;
         case 'extension-src':
         case 'ext-src':
             echo Config::getCurrentBuildDir() . DIRECTORY_SEPARATOR . 'ext';
             break;
         case 'extension-dir':
         case 'ext-dir':
         case 'ext':
             echo ini_get('extension_dir');
             break;
         case 'etc':
             echo Config::getVersionInstallPrefix(Config::getCurrentPhpName()) . DIRECTORY_SEPARATOR . 'etc';
             break;
     }
 }
开发者ID:phpbrew,项目名称:phpbrew,代码行数:38,代码来源:PathCommand.php

示例12: buildMetaFromName

 public function buildMetaFromName($name)
 {
     $path = Config::getBuildDir() . '/' . Config::getCurrentPhpName() . '/ext/' . $name;
     $xml = $path . '/package.xml';
     $m4 = $path . '/config.m4';
     if (file_exists($xml)) {
         $this->logger->warning("===> Using xml extension meta");
         $meta = new ExtensionMetaXml($xml);
     } elseif (file_exists($m4)) {
         $this->logger->warning("===> Using m4 extension meta");
         $meta = new ExtensionMetaM4($m4);
     } else {
         $this->logger->warning("===> Using polyfill extension meta");
         $meta = new ExtensionMetaPolyfill($name);
     }
     return $meta;
 }
开发者ID:bensb,项目名称:phpbrew,代码行数:17,代码来源:Extension.php

示例13: lookup

 public static function lookup($packageName, array $lookupDirectories = array(), $fallback = true)
 {
     if ($fallback) {
         // Always push the PHP source directory to the end of the list for the fallback.
         $lookupDirectories[] = Config::getBuildDir() . '/' . Config::getCurrentPhpName() . '/ext';
     }
     foreach ($lookupDirectories as $lookupDir) {
         if (!file_exists($lookupDir)) {
             continue;
         }
         $extensionDir = $lookupDir . DIRECTORY_SEPARATOR . $packageName;
         if ($ext = self::createFromDirectory($packageName, $extensionDir)) {
             return $ext;
         }
     }
     return new Extension($packageName);
 }
开发者ID:WebDevJL,项目名称:phpbrew,代码行数:17,代码来源:ExtensionFactory.php

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

示例15: execute

 public function execute($buildName = null)
 {
     if (!$buildName) {
         $buildName = Config::getCurrentPhpName();
     }
     if (!$buildName) {
         throw new Exception("PHPBREW_PHP is not set. You should provide the build name in the command.");
     }
     fprintf(STDERR, "*WARNING* php-fpm --pid option requires php >= 5.6, you need to update your php-fpm.conf for the pid file location.\n");
     $root = Config::getRoot();
     $fpmBin = "{$root}/php/{$buildName}/sbin/php-fpm";
     if (!file_exists($fpmBin)) {
         throw new Exception("{$fpmBin} doesn't exist.");
     }
     // TODO: require sudo permission
     if ($this->options->systemctl) {
         $content = $this->generateSystemctlService($buildName, $fpmBin);
         if ($this->options->stdout) {
             echo $content;
             return;
         }
         $file = '/lib/systemd/system/phpbrew-fpm.service';
         if (!is_writable(dirname($file))) {
             $this->logger->error("{$file} is not writable.");
             return;
         }
         $this->logger->info("Writing systemctl service entry: {$file}");
         file_put_contents($file, $content);
         $this->logger->info("To reload systemctl service:");
         $this->logger->info("    systemctl daemon-reload");
         $this->logger->info("Ensure that {$buildName} was built with --fpm-systemd option");
     } elseif ($this->options->initd) {
         $content = $this->generateInitD($buildName, $fpmBin);
         if ($this->options->stdout) {
             echo $content;
             return;
         }
         $file = '/etc/init.d/phpbrew-fpm';
         if (!is_writable(dirname($file))) {
             $this->logger->error("{$file} is not writable.");
             return;
         }
         $this->logger->info("Writing init.d script: {$file}");
         file_put_contents($file, $content);
         chmod($file, 0755);
         // make it executable
         $this->logger->info("To setup the startup item, remember to run update-rc.d to link the init script:");
         $this->logger->info("    sudo update-rc.d phpbrew-fpm defaults");
     } elseif ($this->options->launchctl) {
         $content = $this->generateLaunchctlService($buildName, $fpmBin);
         if ($this->options->stdout) {
             echo $content;
             return;
         }
         $file = '/Library/LaunchDaemons/org.phpbrew.fpm.plist';
         if (!is_writable(dirname($file))) {
             $this->logger->error("{$file} is not writable.");
             return;
         }
         $this->logger->info("Writing launchctl plist file: {$file}");
         file_put_contents($file, $content);
         $this->logger->info("To load the service:");
         $this->logger->info("    sudo launchctl load {$file}");
     } else {
         $this->logger->info('Please use one of the options [--systemctl, --initd, --launchctl] to setup system fpm service.');
     }
 }
开发者ID:phpbrew,项目名称:phpbrew,代码行数:67,代码来源:SetupCommand.php


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