fixed WDT link to the profiler

This commit is contained in:
Fabien Potencier 2011-02-19 14:11:18 +01:00
parent 946d3d9302
commit 2c45611f4e
6 changed files with 19 additions and 31 deletions

View File

@ -5,7 +5,7 @@
xsi:schemaLocation="http://www.symfony-project.org/schema/dic/services http://www.symfony-project.org/schema/dic/services/services-1.0.xsd"> xsi:schemaLocation="http://www.symfony-project.org/schema/dic/services http://www.symfony-project.org/schema/dic/services/services-1.0.xsd">
<parameters> <parameters>
<parameter key="data_collector.config.class">Symfony\Bundle\FrameworkBundle\DataCollector\ConfigDataCollector</parameter> <parameter key="data_collector.config.class">Symfony\Component\HttpKernel\DataCollector\ConfigDataCollector</parameter>
<parameter key="data_collector.request.class">Symfony\Bundle\FrameworkBundle\DataCollector\RequestDataCollector</parameter> <parameter key="data_collector.request.class">Symfony\Bundle\FrameworkBundle\DataCollector\RequestDataCollector</parameter>
<parameter key="data_collector.exception.class">Symfony\Component\HttpKernel\DataCollector\ExceptionDataCollector</parameter> <parameter key="data_collector.exception.class">Symfony\Component\HttpKernel\DataCollector\ExceptionDataCollector</parameter>
<parameter key="data_collector.events.class">Symfony\Component\HttpKernel\DataCollector\EventDataCollector</parameter> <parameter key="data_collector.events.class">Symfony\Component\HttpKernel\DataCollector\EventDataCollector</parameter>
@ -18,7 +18,6 @@
<service id="data_collector.config" class="%data_collector.config.class%" public="false"> <service id="data_collector.config" class="%data_collector.config.class%" public="false">
<tag name="data_collector" template="WebProfilerBundle:Collector:config" id="config" priority="255" /> <tag name="data_collector" template="WebProfilerBundle:Collector:config" id="config" priority="255" />
<argument type="service" id="kernel" /> <argument type="service" id="kernel" />
<argument type="service" id="router" on-invalid="ignore" />
</service> </service>
<service id="data_collector.request" class="%data_collector.request.class%" public="false"> <service id="data_collector.request" class="%data_collector.request.class%" public="false">

View File

@ -149,10 +149,18 @@ class ProfilerController extends ContainerAware
$position = false === strpos($this->container->get('request')->headers->get('user-agent'), 'Mobile') ? 'fixed' : 'absolute'; $position = false === strpos($this->container->get('request')->headers->get('user-agent'), 'Mobile') ? 'fixed' : 'absolute';
} }
$url = null;
try {
$url = $this->container->get('router')->generate('_profiler', array('token' => $token));
} catch (\Exception $e) {
// the profiler is not enabled
}
return $this->container->get('templating')->renderResponse('WebProfilerBundle:Profiler:toolbar.html.twig', array( return $this->container->get('templating')->renderResponse('WebProfilerBundle:Profiler:toolbar.html.twig', array(
'position' => $position, 'position' => $position,
'profiler' => $profiler, 'profiler' => $profiler,
'templates' => $this->getTemplates($profiler), 'templates' => $this->getTemplates($profiler),
'profiler_url' => $url,
)); ));
} }

View File

@ -8,5 +8,5 @@
{{ collector.phpversion }}<span style="margin: 0; padding: 0; color: #aaa">|</span><span style="color: {{ collector.hasxdebug ? '#3a3' : '#a33' }}">xdebug</span><span style="margin: 0; padding: 0; color: #aaa">|</span><span style="color: {{ collector.hasaccelerator ? '#3a3' : '#a33' }}">accel</span> {{ collector.phpversion }}<span style="margin: 0; padding: 0; color: #aaa">|</span><span style="color: {{ collector.hasxdebug ? '#3a3' : '#a33' }}">xdebug</span><span style="margin: 0; padding: 0; color: #aaa">|</span><span style="color: {{ collector.hasaccelerator ? '#3a3' : '#a33' }}">accel</span>
<img style="margin: 0 5px 0 10px; vertical-align: middle; height: 24px" width="24" height="24" alt="Environment" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAXtJREFUeNpi/P//P8NAAsZRB6A7gJGRMQFIxdPIvoVA+xYgC7Cgq4iPj693d3dXoIXtO3fuBJm7AG8ILF26lKZxEh0dzYg3BP79+0fXNDD4HPD371+MhAqlsUUNuXIkOWDAQ4C+Dvjz5w8KPzc3F1wmTJ48mT4F0cSJE8ECN27c2IBNg4aGRgAlaSA/P5+RqBBQUVG5gM0BQPkAYnxWUlICDrmenh7yoqCiosIBRHd0dDhC+fuhfLwG3r59GxxyycnJYIdev34dzFdVVQ0gKgpaW1v/U5jVGnC4DSxeXV3NSLVcUF9fDw7mxsZGZDEHqJgjlL8fXQ3eEKirqyMYAvfu3cOaQJWUlAgm0KamJkaSsiE2ICcnR1ECpdgB3d3d4GAuLS11hPL3Q/mUlwNFRUWUJkK8cn19fdRLhHQpiqdNmwZO6VlZWRiayZUjKQSsra0bcIUMuXJ400BqaipNm2SzZ88e5GlgMLQJQWVmPY3saxztmo06AB0ABBgA4G/dmZ3TlQ8AAAAASUVORK5CYII=" /> <img style="margin: 0 5px 0 10px; vertical-align: middle; height: 24px" width="24" height="24" alt="Environment" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAXtJREFUeNpi/P//P8NAAsZRB6A7gJGRMQFIxdPIvoVA+xYgC7Cgq4iPj693d3dXoIXtO3fuBJm7AG8ILF26lKZxEh0dzYg3BP79+0fXNDD4HPD371+MhAqlsUUNuXIkOWDAQ4C+Dvjz5w8KPzc3F1wmTJ48mT4F0cSJE8ECN27c2IBNg4aGRgAlaSA/P5+RqBBQUVG5gM0BQPkAYnxWUlICDrmenh7yoqCiosIBRHd0dDhC+fuhfLwG3r59GxxyycnJYIdev34dzFdVVQ0gKgpaW1v/U5jVGnC4DSxeXV3NSLVcUF9fDw7mxsZGZDEHqJgjlL8fXQ3eEKirqyMYAvfu3cOaQJWUlAgm0KamJkaSsiE2ICcnR1ECpdgB3d3d4GAuLS11hPL3Q/mUlwNFRUWUJkK8cn19fdRLhHQpiqdNmwZO6VlZWRiayZUjKQSsra0bcIUMuXJ400BqaipNm2SzZ88e5GlgMLQJQWVmPY3saxztmo06AB0ABBgA4G/dmZ3TlQ8AAAAASUVORK5CYII=" />
{{ collector.appname }}<span style="margin: 0; padding: 0; color: #aaa">|</span>{{ collector.env }}<span style="margin: 0; padding: 0; color: #aaa">|</span>{{ collector.debug ? 'debug' : 'no-debug' }}<span style="margin: 0; padding: 0; color: #aaa">|</span>{% if collector.url %}<a style="color: #000" href="{{ collector.url }}">{{ collector.token }}</a>{% else %}{{ collector.token }}{% endif %} {{ collector.appname }}<span style="margin: 0; padding: 0; color: #aaa">|</span>{{ collector.env }}<span style="margin: 0; padding: 0; color: #aaa">|</span>{{ collector.debug ? 'debug' : 'no-debug' }}<span style="margin: 0; padding: 0; color: #aaa">|</span>{% if profiler_url %}<a style="color: #000" href="{{ profiler_url }}">{{ collector.token }}</a>{% else %}{{ collector.token }}{% endif %}
{% endblock %} {% endblock %}

View File

@ -22,7 +22,7 @@
{% endif %} {% endif %}
> >
{% for name, template in templates %} {% for name, template in templates %}
{{ template.renderblock('toolbar', { 'collector': profiler.get(name) }) }} {{ template.renderblock('toolbar', { 'collector': profiler.get(name), 'profiler_url': profiler_url }) }}
{% endfor %} {% endfor %}
{% if 'normal' != position %} {% if 'normal' != position %}
<img style="float: right; cursor: pointer; margin: 0 10px; vertical-align: middle" width="24" height="24" alt="Hide Toolbar" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAwBJREFUeNrUVltrGkEUPlOvuah58R6Ehr4KAd8Cgb60CaTEP1Eo9AcFCv0TCZYQ+u5bfkFaEy9LYoRCqrvRmdXtd9bZdHW1pg996MDnzM7Mnm/ON+ecVTiOQ/+yvaB/3MLe4OLiwj//Erj+S1sloOU9HBwcLPSgCJwDDd0Xn2m4BjR1X1rowXg85u4EOAyHw2Tb9iHGdWAPMFYYL0ciEVJKHWH8GXgbuAMQFIFjHqfTaYrHYzxXAup6jebAazWgHI1GaWdnh0KhMM+/AV4FCHBiAzgbjUZkGAYlEkmKxWI8XwLqQBEgDZ6rAWX2Np/PU6PRIMsyee0r8C0gEdzj7iPrjnGFSbLZLCkYNAeDkk+ukCdLPB6nTCZDzWaTBoMB6cB4v/AONAFrXQVOmaQDEjagpCTTND2SBza+vr5OuVyOOp2O3/hrfyQtIgiSjCRlsmmSILEsy42QjY0N2t7eplarRf1+f6nxGQIJAqHHDpM4VBWCTiWTtEdTuZR0F9n4d2jef4AzQiw1PusBTjjXfnsiZYWlYJK1tTW6urpaefKgB0ECr0Vdr1CzhsMhwnBCErLp/Xzh42eVigUEXlaXI4hz1v3u7o4mkwkVCgVIKtmL0qpk9N3BVF+IyndRxM85Ht0kSmxuUq/XoxFOLoRDNzdNKhby7qEGmsQhsUfCMTwbC+5A+U/uxnksFqVUMukaZ3m05j+kVJUbxH4up0lm88RYcskgEE4RUtdwzN1YNEKp1BZ1u10aPj5OjQux755QR1e7rUmUJnFEHWsgcYxAqeBNUtontlK7LFIymXI17/d/cjZfIyf2scdwIWUVB7o0Bya1kQsp7I1HUVaUKtlKfvKpMVOLUGvU8RiXmEgm6P7+3g1FpabGFdcq9VSLULdUFXOXpmW5CZfa2nKlx/4jrlUBifgldGfAcff2luxp+WbN95dEyFOe4N0KFzuOMLQv/ryY/x5wsQthfKQ3fvjDt8BPcqJL/Zm2sfSDwy+8m//8rWgeSRrozS+K//5fxS8BBgCXGQk7P2P29gAAAABJRU5ErkJggg==" onclick="this.parentNode.previousSibling.style.display = this.parentNode.style.display = 'none';" /> <img style="float: right; cursor: pointer; margin: 0 10px; vertical-align: middle" width="24" height="24" alt="Hide Toolbar" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAwBJREFUeNrUVltrGkEUPlOvuah58R6Ehr4KAd8Cgb60CaTEP1Eo9AcFCv0TCZYQ+u5bfkFaEy9LYoRCqrvRmdXtd9bZdHW1pg996MDnzM7Mnm/ON+ecVTiOQ/+yvaB/3MLe4OLiwj//Erj+S1sloOU9HBwcLPSgCJwDDd0Xn2m4BjR1X1rowXg85u4EOAyHw2Tb9iHGdWAPMFYYL0ciEVJKHWH8GXgbuAMQFIFjHqfTaYrHYzxXAup6jebAazWgHI1GaWdnh0KhMM+/AV4FCHBiAzgbjUZkGAYlEkmKxWI8XwLqQBEgDZ6rAWX2Np/PU6PRIMsyee0r8C0gEdzj7iPrjnGFSbLZLCkYNAeDkk+ukCdLPB6nTCZDzWaTBoMB6cB4v/AONAFrXQVOmaQDEjagpCTTND2SBza+vr5OuVyOOp2O3/hrfyQtIgiSjCRlsmmSILEsy42QjY0N2t7eplarRf1+f6nxGQIJAqHHDpM4VBWCTiWTtEdTuZR0F9n4d2jef4AzQiw1PusBTjjXfnsiZYWlYJK1tTW6urpaefKgB0ECr0Vdr1CzhsMhwnBCErLp/Xzh42eVigUEXlaXI4hz1v3u7o4mkwkVCgVIKtmL0qpk9N3BVF+IyndRxM85Ht0kSmxuUq/XoxFOLoRDNzdNKhby7qEGmsQhsUfCMTwbC+5A+U/uxnksFqVUMukaZ3m05j+kVJUbxH4up0lm88RYcskgEE4RUtdwzN1YNEKp1BZ1u10aPj5OjQux755QR1e7rUmUJnFEHWsgcYxAqeBNUtontlK7LFIymXI17/d/cjZfIyf2scdwIWUVB7o0Bya1kQsp7I1HUVaUKtlKfvKpMVOLUGvU8RiXmEgm6P7+3g1FpabGFdcq9VSLULdUFXOXpmW5CZfa2nKlx/4jrlUBifgldGfAcff2luxp+WbN95dEyFOe4N0KFzuOMLQv/ryY/x5wsQthfKQ3fvjDt8BPcqJL/Zm2sfSDwy+8m//8rWgeSRrozS+K//5fxS8BBgCXGQk7P2P29gAAAABJRU5ErkJggg==" onclick="this.parentNode.previousSibling.style.display = this.parentNode.style.display = 'none';" />

View File

@ -9,14 +9,13 @@
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
namespace Symfony\Bundle\FrameworkBundle\DataCollector; namespace Symfony\Component\HttpKernel\DataCollector;
use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\HttpKernel\DataCollector\DataCollector; use Symfony\Component\HttpKernel\DataCollector\DataCollector;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\RouterInterface;
/** /**
* ConfigDataCollector. * ConfigDataCollector.
@ -26,18 +25,15 @@ use Symfony\Component\Routing\RouterInterface;
class ConfigDataCollector extends DataCollector class ConfigDataCollector extends DataCollector
{ {
protected $kernel; protected $kernel;
protected $router;
/** /**
* Constructor. * Constructor.
* *
* @param KernelInterface $kernel A KernelInterface instance * @param KernelInterface $kernel A KernelInterface instance
* @param RouterInterface $router A RouterInterface instance
*/ */
public function __construct(KernelInterface $kernel, RouterInterface $router = null) public function __construct(KernelInterface $kernel)
{ {
$this->kernel = $kernel; $this->kernel = $kernel;
$this->router = $router;
} }
/** /**
@ -63,24 +59,6 @@ class ConfigDataCollector extends DataCollector
); );
} }
/**
* Gets the URL.
*
* @return string The URL
*/
public function getUrl()
{
if (null !== $this->router) {
try {
return $this->router->generate('_profiler', array('token' => $this->data['token']));
} catch (\Exception $e) {
// the route is not registered
}
}
return false;
}
/** /**
* Gets the token. * Gets the token.
* *

View File

@ -157,6 +157,9 @@ class SqliteProfilerStorage implements ProfilerStorageInterface
} }
$res = $stmt->execute(); $res = $stmt->execute();
if (false === $res) {
throw new \RuntimeException(sprintf('Error executing SQLite query "%s"', $query));
}
$res->finalize(); $res->finalize();
} else { } else {
foreach ($args as $arg => $val) { foreach ($args as $arg => $val) {