本文整理汇总了PHP中PhpBrew\Config::getVersionBuildPrefix方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::getVersionBuildPrefix方法的具体用法?PHP Config::getVersionBuildPrefix怎么用?PHP Config::getVersionBuildPrefix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhpBrew\Config
的用法示例。
在下文中一共展示了Config::getVersionBuildPrefix方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepareForVersion
public function prepareForVersion($version)
{
$home = Config::getPhpbrewRoot();
$buildDir = Config::getBuildDir();
$variantsDir = Config::getVariantsDir();
$buildPrefix = Config::getVersionBuildPrefix($version);
if (!file_exists($variantsDir)) {
mkdir($variantsDir, 0755, true);
}
if (!file_exists($buildDir)) {
mkdir($buildDir, 0755, true);
}
if (!file_exists($buildPrefix)) {
mkdir($buildPrefix, 0755, true);
}
}
示例2: 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;
}
}
示例3: 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";
}
}
示例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::getVersionBuildPrefix($name);
if (file_exists($prefix)) {
// a installation exists
$build = new self($prefix);
return $build;
}
/*
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";
*/
return null;
}
示例5: removeByVersion
public function removeByVersion($version, $verbose = false)
{
$home = Config::getPhpbrewRoot();
$buildPrefix = Config::getVersionBuildPrefix($version);
$this->remove($buildPrefix);
}
示例6: cleanByVersion
public function cleanByVersion($version, $verbose = false)
{
$home = Config::getPhpbrewRoot();
$buildPrefix = Config::getVersionBuildPrefix($version);
return $this->clean($buildPrefix);
}
示例7: execute
public function execute($version)
{
if (!preg_match('/^php-/', $version)) {
$version = 'php-' . $version;
}
$version = $this->getLatestMinorVersion($version, $this->options->old);
$options = $this->options;
$logger = $this->logger;
// get options and variants for building php
$args = func_get_args();
// the first argument is the target version.
array_shift($args);
$name = $this->options->name ?: $version;
// find inherited variants
$inheritedVariants = array();
if ($this->options->like) {
$inheritedVariants = VariantParser::getInheritedVariants($this->options->like);
}
// ['extra_options'] => the extra options to be passed to ./configure command
// ['enabled_variants'] => enabeld variants
// ['disabled_variants'] => disabled variants
$variantInfo = VariantParser::parseCommandArguments($args, $inheritedVariants);
$info = PhpSource::getVersionInfo($version, $this->options->old);
if (!$info) {
throw new Exception("Version {$version} not found.");
}
$prepare = new PrepareDirectoryTask($this->logger);
$prepare->prepareForVersion($version);
// convert patch to realpath
if ($this->options->patch) {
$patchPaths = array();
foreach ($this->options->patch as $patch) {
/** @var \SplFileInfo $patch */
$patchPath = realpath($patch);
if ($patchPath !== false) {
$patchPaths[(string) $patch] = $patchPath;
}
}
// rewrite patch paths
$this->options->keys['patch']->value = $patchPaths;
}
// Move to to build directory, because we are going to download distribution.
$buildDir = Config::getBuildDir();
chdir($buildDir);
$download = new DownloadTask($this->logger);
$targetDir = $download->downloadByVersionString($version, $this->options->old, $this->options->force);
if (!file_exists($targetDir)) {
throw new Exception("Download failed.");
}
// Change directory to the downloaded source directory.
chdir($targetDir);
$buildPrefix = Config::getVersionBuildPrefix($version);
if (!file_exists($buildPrefix)) {
mkdir($buildPrefix, 0755, true);
}
// write variants info.
$variantInfoFile = $buildPrefix . DIRECTORY_SEPARATOR . 'phpbrew.variants';
$this->logger->debug("Writing variant info to {$variantInfoFile}");
file_put_contents($variantInfoFile, serialize($variantInfo));
// The build object, contains the information to build php.
$build = new Build($version, $name, $buildPrefix);
$build->setInstallPrefix($buildPrefix);
$build->setSourceDirectory($targetDir);
$builder = new Builder($targetDir, $version);
$builder->logger = $this->logger;
$builder->options = $this->options;
$this->logger->debug('Build Directory: ' . realpath($targetDir));
foreach ($variantInfo['enabled_variants'] as $name => $value) {
$build->enableVariant($name, $value);
}
foreach ($variantInfo['disabled_variants'] as $name => $value) {
$build->disableVariant($name);
if ($build->hasVariant($name)) {
$this->logger->warn("Removing variant {$name} since we've disabled it from command.");
$build->removeVariant($name);
}
}
$build->setExtraOptions($variantInfo['extra_options']);
if ($options->clean) {
$clean = new CleanTask($this->logger);
$clean->cleanByVersion($version);
}
$buildLogFile = Config::getVersionBuildLogPath($version);
$configure = new \PhpBrew\Tasks\ConfigureTask($this->logger);
$configure->configure($build, $this->options);
$buildTask = new BuildTask($this->logger);
$buildTask->setLogPath($buildLogFile);
$buildTask->build($build, $this->options);
if ($options->{'test'}) {
$test = new TestTask($this->logger);
$test->setLogPath($buildLogFile);
$test->test($build, $this->options);
}
$install = new InstallTask($this->logger);
$install->setLogPath($buildLogFile);
$install->install($build, $this->options);
if ($options->{'post-clean'}) {
$clean = new CleanTask($this->logger);
$clean->cleanByVersion($version);
}
//.........这里部分代码省略.........
示例8: getInheritedVariants
/**
* Returns array with the variants for the
* given version
* @param string $version
* @throws Exception
* @return mixed
*/
public static function getInheritedVariants($version)
{
if (!preg_match('/^php-/', $version)) {
$version = 'php-' . $version;
}
$installedVersions = Config::getInstalledPhpVersions();
if (array_search($version, $installedVersions) === false) {
throw new Exception("Can't inherit variants from {$version} because this version is not installed!");
}
$variantsFile = Config::getVersionBuildPrefix($version) . DIRECTORY_SEPARATOR . 'phpbrew.variants';
if (!is_readable($variantsFile)) {
throw new Exception("Can't inherit variant from {$version}!" . "Variants file {$variantsFile} is not readable.");
}
return unserialize(file_get_contents($variantsFile));
}