diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/config.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/config.html.twig index 46234cda974d..a413af32bb1b 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/config.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/config.html.twig @@ -192,35 +192,35 @@
- {{ include('@WebProfiler/Icon/' ~ (collector.hasaccelerator ? 'yes' : 'no') ~ '.svg') }} - PHP acceleration + {{ collector.phparchitecture }} bits + Architecture
- {{ include('@WebProfiler/Icon/' ~ (collector.hasxdebug ? 'yes' : 'no') ~ '.svg') }} - Xdebug + {{ collector.phpintllocale }} + Intl locale
- -
- {{ include('@WebProfiler/Icon/' ~ (collector.haszendopcache ? 'yes' : 'no') ~ '.svg') }} - OPcache + {{ collector.phptimezone }} + Timezone
+
+
- {{ include('@WebProfiler/Icon/' ~ (collector.hasapc ? 'yes' : 'no') ~ '.svg') }} - APC + {{ include('@WebProfiler/Icon/' ~ (collector.haszendopcache ? 'yes' : 'no') ~ '.svg') }} + OPcache
- {{ include('@WebProfiler/Icon/' ~ (collector.hasxcache ? 'yes' : 'no') ~ '.svg') }} - XCache + {{ include('@WebProfiler/Icon/' ~ (collector.hasapcu ? 'yes' : 'no') ~ '.svg') }} + APCu
- {{ include('@WebProfiler/Icon/' ~ (collector.haseaccelerator ? 'yes' : 'no') ~ '.svg') }} - EAccelerator + {{ include('@WebProfiler/Icon/' ~ (collector.hasxdebug ? 'yes' : 'no') ~ '.svg') }} + Xdebug
diff --git a/src/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php index 13db7c431480..13b53f18b006 100644 --- a/src/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php +++ b/src/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php @@ -67,11 +67,11 @@ public function collect(Request $request, Response $response, \Exception $except 'env' => isset($this->kernel) ? $this->kernel->getEnvironment() : 'n/a', 'debug' => isset($this->kernel) ? $this->kernel->isDebug() : 'n/a', 'php_version' => PHP_VERSION, + 'php_architecture' => PHP_INT_SIZE * 8, + 'php_intl_locale' => \Locale::getDefault() ?: 'n/a', + 'php_timezone' => date_default_timezone_get(), 'xdebug_enabled' => extension_loaded('xdebug'), - 'eaccel_enabled' => extension_loaded('eaccelerator') && ini_get('eaccelerator.enable'), - 'apc_enabled' => extension_loaded('apc') && ini_get('apc.enabled'), - 'xcache_enabled' => extension_loaded('xcache') && ini_get('xcache.cacher'), - 'wincache_enabled' => extension_loaded('wincache') && ini_get('wincache.ocenabled'), + 'apcu_enabled' => extension_loaded('apcu') && ini_get('apc.enabled'), 'zend_opcache_enabled' => extension_loaded('Zend OPcache') && ini_get('opcache.enable'), 'bundles' => array(), 'sapi_name' => PHP_SAPI, @@ -136,6 +136,30 @@ public function getPhpVersion() return $this->data['php_version']; } + /** + * @return int The PHP architecture as number of bits (e.g. 32 or 64) + */ + public function getPhpArchitecture() + { + return $this->data['php_architecture']; + } + + /** + * @return string + */ + public function getPhpIntlLocale() + { + return $this->data['php_intl_locale']; + } + + /** + * @return string + */ + public function getPhpTimezone() + { + return $this->data['php_timezone']; + } + /** * Gets the application name. * @@ -177,23 +201,13 @@ public function hasXDebug() } /** - * Returns true if EAccelerator is enabled. + * Returns true if APCu is enabled. * - * @return bool true if EAccelerator is enabled, false otherwise + * @return bool true if APCu is enabled, false otherwise */ - public function hasEAccelerator() + public function hasApcu() { - return $this->data['eaccel_enabled']; - } - - /** - * Returns true if APC is enabled. - * - * @return bool true if APC is enabled, false otherwise - */ - public function hasApc() - { - return $this->data['apc_enabled']; + return $this->data['apcu_enabled']; } /** @@ -206,36 +220,6 @@ public function hasZendOpcache() return $this->data['zend_opcache_enabled']; } - /** - * Returns true if XCache is enabled. - * - * @return bool true if XCache is enabled, false otherwise - */ - public function hasXCache() - { - return $this->data['xcache_enabled']; - } - - /** - * Returns true if WinCache is enabled. - * - * @return bool true if WinCache is enabled, false otherwise - */ - public function hasWinCache() - { - return $this->data['wincache_enabled']; - } - - /** - * Returns true if any accelerator is enabled. - * - * @return bool true if any accelerator is enabled, false otherwise - */ - public function hasAccelerator() - { - return $this->hasApc() || $this->hasZendOpcache() || $this->hasEAccelerator() || $this->hasXCache() || $this->hasWinCache(); - } - public function getBundles() { return $this->data['bundles']; diff --git a/src/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php b/src/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php index fea95b4e2b49..1cc76e02c49c 100644 --- a/src/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php +++ b/src/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php @@ -31,30 +31,14 @@ public function testCollect() $this->assertSame('config', $c->getName()); $this->assertSame('testkernel', $c->getAppName()); $this->assertSame(PHP_VERSION, $c->getPhpVersion()); + $this->assertSame(PHP_INT_SIZE * 8, $c->getPhpArchitecture()); + $this->assertSame(\Locale::getDefault() ?: 'n/a', $c->getPhpIntlLocale()); + $this->assertSame(date_default_timezone_get(), $c->getPhpTimezone()); $this->assertSame(Kernel::VERSION, $c->getSymfonyVersion()); $this->assertNull($c->getToken()); - - // if else clause because we don't know it - if (extension_loaded('xdebug')) { - $this->assertTrue($c->hasXDebug()); - } else { - $this->assertFalse($c->hasXDebug()); - } - - // if else clause because we don't know it - if (((extension_loaded('eaccelerator') && ini_get('eaccelerator.enable')) - || - (extension_loaded('apc') && ini_get('apc.enabled')) - || - (extension_loaded('Zend OPcache') && ini_get('opcache.enable')) - || - (extension_loaded('xcache') && ini_get('xcache.cacher')) - || - (extension_loaded('wincache') && ini_get('wincache.ocenabled')))) { - $this->assertTrue($c->hasAccelerator()); - } else { - $this->assertFalse($c->hasAccelerator()); - } + $this->assertSame(extension_loaded('xdebug'), $c->hasXDebug()); + $this->assertSame(extension_loaded('Zend OPcache') && ini_get('opcache.enable'), $c->hasZendOpcache()); + $this->assertSame(extension_loaded('apcu') && ini_get('apc.enabled'), $c->hasApcu()); } }