feature #10786 [FrameworkBundle] removed support for HHVM built-in web server as it is deprecated now (fabpot)

This PR was merged into the 2.5-dev branch.

Discussion
----------

[FrameworkBundle] removed support for HHVM built-in web server as it is deprecated now

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #10774
| License       | MIT
| Doc PR        | n/a

Commits
-------

7f7e2d8 [FrameworkBundle] removed support for HHVM built-in web server as it is deprecated now
This commit is contained in:
Fabien Potencier 2014-04-25 14:08:25 +02:00
commit 9d0de5b57b

View File

@ -29,7 +29,7 @@ class ServerRunCommand extends ContainerAwareCommand
*/
public function isEnabled()
{
if (version_compare(phpversion(), '5.4.0', '<')) {
if (version_compare(phpversion(), '5.4.0', '<') || defined('HHVM_VERSION')) {
return false;
}
@ -96,12 +96,7 @@ EOF
->locateResource(sprintf('@FrameworkBundle/Resources/config/router_%s.php', $env))
;
if (defined('HHVM_VERSION')) {
$builder = $this->createHhvmProcessBuilder($input, $output, $env);
} else {
$builder = $this->createPhpProcessBuilder($input, $output, $env);
}
$builder = $this->createPhpProcessBuilder($input, $output, $env);
$builder->setWorkingDirectory($input->getOption('docroot'));
$builder->setTimeout(null);
$builder->getProcess()->run(function ($type, $buffer) use ($output) {
@ -121,59 +116,4 @@ EOF
return new ProcessBuilder(array(PHP_BINARY, '-S', $input->getArgument('address'), $router));
}
private function createHhvmProcessBuilder(InputInterface $input, OutputInterface $output, $env)
{
list($ip, $port) = explode(':', $input->getArgument('address'));
$docroot = realpath($input->getOption('docroot'));
$bootstrap = 'prod' === $env ? 'app.php' : 'app_dev.php';
$config = <<<EOF
Server {
IP = $ip
Port = $port
SourceRoot = $docroot
RequestTimeoutSeconds = -1
RequestMemoryMaxBytes = -1
}
VirtualHost {
* {
Pattern = .*
RewriteRules {
* {
pattern = .?
# app bootstrap
to = $bootstrap
# append the original query string
qsa = true
}
}
}
}
StaticFile {
Extensions {
css = text/css
gif = image/gif
html = text/html
jpe = image/jpeg
jpeg = image/jpeg
jpg = image/jpeg
png = image/png
tif = image/tiff
tiff = image/tiff
txt = text/plain
php = text/plain
}
}
EOF;
$configFile = $this->getContainer()->get('kernel')->getCacheDir().'/hhvm-server-'.md5($config).'.hdf';
file_put_contents($configFile, $config);
return new ProcessBuilder(array(PHP_BINARY, '--mode', 'server', '--config', $configFile));
}
}