本文整理汇总了PHP中PhpBrew\Config::getDistFileDir方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::getDistFileDir方法的具体用法?PHP Config::getDistFileDir怎么用?PHP Config::getDistFileDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhpBrew\Config
的用法示例。
在下文中一共展示了Config::getDistFileDir方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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}");
}
示例2: run
public function run(Build $build = NULL)
{
$dirs = array();
$dirs[] = Config::getPhpbrewRoot();
$dirs[] = Config::getPhpbrewHome();
$dirs[] = Config::getBuildDir();
$dirs[] = Config::getDistFileDir();
$dirs[] = Config::getVariantsDir();
if ($build) {
$dirs[] = Config::getInstallPrefix() . DIRECTORY_SEPARATOR . $build->getName();
}
foreach ($dirs as $dir) {
if (!file_exists($dir)) {
$this->logger->debug("Creating directory {$dir}");
mkdir($dir, 0755, true);
}
}
}
示例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: download
public function download(Provider $provider, $version = 'stable')
{
$url = $provider->buildPackageDownloadUrl($version);
$downloader = new Downloader\UrlDownloader($this->logger, $this->options);
$basename = $provider->resolveDownloadFileName($version);
$distDir = Config::getDistFileDir();
$targetFilePath = $distDir . DIRECTORY_SEPARATOR . $basename;
$downloader->download($url, $targetFilePath);
$info = pathinfo($basename);
$currentPhpExtensionDirectory = Config::getBuildDir() . '/' . Config::getCurrentPhpName() . '/ext';
// tar -C ~/.phpbrew/build/php-5.5.8/ext -xvf ~/.phpbrew/distfiles/memcache-2.2.7.tgz
$extensionDir = $currentPhpExtensionDirectory . DIRECTORY_SEPARATOR . $provider->getPackageName();
if (!file_exists($extensionDir)) {
mkdir($extensionDir, 0755, true);
}
$this->logger->info("===> Extracting to {$currentPhpExtensionDirectory}...");
$cmds = array_merge($provider->extractPackageCommands($currentPhpExtensionDirectory, $targetFilePath), $provider->postExtractPackageCommands($currentPhpExtensionDirectory, $targetFilePath));
foreach ($cmds as $cmd) {
$this->logger->debug($cmd);
Utils::system($cmd);
}
return $extensionDir;
}
示例5: execute
//.........这里部分代码省略.........
$variantInfo = VariantParser::parseCommandArguments($args);
$build->loadVariantInfo($variantInfo);
// load again
// assume +default variant if no build config is given and warn about that
if (!$variantInfo['enabled_variants']) {
$build->setBuildSettings(new DefaultBuildSettings());
$this->logger->notice("You haven't set any variant. A default set of extensions will be installed for the minimum requirement:");
$this->logger->notice('[' . implode(', ', array_keys($build->getVariants())) . ']');
$this->logger->notice("Please run 'phpbrew variants' for more information.\n");
}
if (preg_match('/5\\.3\\./', $version)) {
$this->logger->notice("PHP 5.3 requires +intl, enabled by default.");
$build->enableVariant('intl');
}
// always add +xml by default unless --without-pear is present
// TODO: This can be done by "-pear"
if (!in_array('--without-pear', $variantInfo['extra_options'])) {
$build->enableVariant('xml');
}
$this->logger->info('===> Loading and resolving variants...');
$removedVariants = $build->loadVariantInfo($variantInfo);
if (!empty($removedVariants)) {
$this->logger->debug('Removed variants: ' . join(',', $removedVariants));
}
$prepareTask = new PrepareDirectoryTask($this->logger, $this->options);
$prepareTask->run($build);
// Move to to build directory, because we are going to download distribution.
$buildDir = $this->options->{'build-dir'} ?: Config::getBuildDir();
if (!file_exists($buildDir)) {
mkdir($buildDir, 0755, true);
}
$variantBuilder = new VariantBuilder();
$variants = $variantBuilder->build($build);
$distFileDir = Config::getDistFileDir();
$downloadTask = new DownloadTask($this->logger, $this->options);
$targetFilePath = $downloadTask->download($distUrl, $distFileDir, isset($versionInfo['md5']) ? $versionInfo['md5'] : NULL);
if (!file_exists($targetFilePath)) {
throw new Exception("Download failed, {$targetFilePath} does not exist.");
}
unset($downloadTask);
$extractTask = new ExtractTask($this->logger, $this->options);
$targetDir = $extractTask->extract($build, $targetFilePath, $buildDir);
if (!file_exists($targetDir)) {
throw new Exception("Extract failed, {$targetDir} does not exist.");
}
unset($extractTask);
// Update build source directory
$this->logger->debug('Source Directory: ' . realpath($targetDir));
$build->setSourceDirectory($targetDir);
if (!$this->options->{'no-clean'} && file_exists($targetDir . DIRECTORY_SEPARATOR . 'Makefile')) {
$this->logger->info("Found existing Makefile, running make clean to ensure everything will be rebuilt.");
$this->logger->info("You can append --no-clean option after the install command if you don't want to rebuild.");
$clean->clean($build);
}
// Change directory to the downloaded source directory.
chdir($targetDir);
// Write variants info.
$variantInfoFile = $build->getInstallPrefix() . DIRECTORY_SEPARATOR . 'phpbrew.variants';
$this->logger->debug("Writing variant info to {$variantInfoFile}");
if (false === $build->writeVariantInfoFile($variantInfoFile)) {
$this->logger->warn("Can't store variant info.");
}
$buildLogFile = $build->getBuildLogPath();
if (!$this->options->{'no-configure'}) {
$configureTask = new ConfigureTask($this->logger, $this->options);
$configureTask->run($build, $variants);
示例6: execute
//.........这里部分代码省略.........
$variantInfo = VariantParser::parseCommandArguments($args);
$build->loadVariantInfo($variantInfo);
// load again
// assume +default variant if no build config is given and warn about that
if (!$variantInfo['enabled_variants']) {
$build->setBuildSettings(new DefaultBuildSettings());
$this->logger->notice("You haven't set any variant. A default set of extensions will be installed for the minimum requirement:");
$this->logger->notice('[' . implode(', ', array_keys($build->getVariants())) . ']');
$this->logger->notice("Please run 'phpbrew variants' for more information.\n");
}
if (preg_match('/5\\.3\\./', $version)) {
$this->logger->notice('PHP 5.3 requires +intl, enabled by default.');
$build->enableVariant('intl');
}
// always add +xml by default unless --without-pear is present
// TODO: This can be done by "-pear"
if (!in_array('--without-pear', $variantInfo['extra_options'])) {
$build->enableVariant('xml');
}
$this->logger->info('===> Loading and resolving variants...');
$removedVariants = $build->loadVariantInfo($variantInfo);
if (!empty($removedVariants)) {
$this->logger->debug('Removed variants: ' . implode(',', $removedVariants));
}
$prepareTask = new PrepareDirectoryTask($this->logger, $this->options);
$prepareTask->run($build);
// Move to to build directory, because we are going to download distribution.
$buildDir = $this->options->{'build-dir'} ?: Config::getBuildDir();
if (!file_exists($buildDir)) {
mkdir($buildDir, 0755, true);
}
$variantBuilder = new VariantBuilder();
$configureOptions = $variantBuilder->build($build);
$distFileDir = Config::getDistFileDir();
$downloadTask = new DownloadTask($this->logger, $this->options);
$targetFilePath = $downloadTask->download($distUrl, $distFileDir, isset($versionInfo['md5']) ? $versionInfo['md5'] : null);
if (!file_exists($targetFilePath)) {
throw new SystemCommandException("Download failed, {$targetFilePath} does not exist.", $build);
}
unset($downloadTask);
$extractTask = new ExtractTask($this->logger, $this->options);
$targetDir = $extractTask->extract($build, $targetFilePath, $buildDir);
if (!file_exists($targetDir)) {
throw new SystemCommandException("Extract failed, {$targetDir} does not exist.", $build);
}
unset($extractTask);
// Update build source directory
$this->logger->debug('Source Directory: ' . realpath($targetDir));
$build->setSourceDirectory($targetDir);
if (!$this->options->{'no-clean'} && file_exists($targetDir . DIRECTORY_SEPARATOR . 'Makefile')) {
$this->logger->info('Found existing Makefile, running make clean to ensure everything will be rebuilt.');
$this->logger->info("You can append --no-clean option after the install command if you don't want to rebuild.");
$clean->clean($build);
}
// Change directory to the downloaded source directory.
chdir($targetDir);
// Write variants info.
$variantInfoFile = $build->getInstallPrefix() . DIRECTORY_SEPARATOR . 'phpbrew.variants';
$this->logger->debug("Writing variant info to {$variantInfoFile}");
if (false === $build->writeVariantInfoFile($variantInfoFile)) {
$this->logger->warn("Can't store variant info.");
}
$buildLogFile = $build->getBuildLogPath();
if (!$this->options->{'no-configure'}) {
$configureTask = new BeforeConfigureTask($this->logger, $this->options);
$configureTask->run($build);