本文整理汇总了PHP中PhpBrew\Config::getVersionInstallPrefix方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::getVersionInstallPrefix方法的具体用法?PHP Config::getVersionInstallPrefix怎么用?PHP Config::getVersionInstallPrefix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhpBrew\Config
的用法示例。
在下文中一共展示了Config::getVersionInstallPrefix方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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";
}
}
}
示例2: execute
public function execute($buildName)
{
$prefix = Config::getVersionInstallPrefix($buildName);
if (!file_exists($prefix)) {
throw new Exception("{$prefix} does not exist.");
}
$prompter = new \CLIFramework\Prompter();
$answer = $prompter->ask("Are you sure to delete {$buildName}?", array('Y', 'n'), 'Y');
if (strtolower($answer) == "y") {
Utils::recursive_unlink($prefix, $this->logger);
$this->logger->info("{$buildName} is removed. I hope you're not surprised. :)");
} else {
$this->logger->info("Let me guess, you drunk tonight.");
}
}
示例3: 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;
}
}
示例4: findByName
/**
* Find a installed build by name,
* currently a $name is a php version, but in future we may have customized
* name for users.
*
* @param string $name
* @return Build
*/
public static function findByName($name)
{
$prefix = Config::getVersionInstallPrefix($name);
if (file_exists($prefix)) {
// a installation exists
return new self($name, NULL, $prefix);
}
return null;
}
示例5: removeByVersion
public function removeByVersion($version, $verbose = false)
{
$home = Config::getPhpbrewRoot();
$buildPrefix = Config::getVersionInstallPrefix($version);
$this->remove($buildPrefix);
}