Skip to content

Commit 2c45611

Browse files
committed
fixed WDT link to the profiler
1 parent 946d3d9 commit 2c45611

File tree

6 files changed

+19
-31
lines changed

6 files changed

+19
-31
lines changed

src/Symfony/Bundle/FrameworkBundle/Resources/config/collectors.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
xsi:schemaLocation="http://www.symfony-project.org/schema/dic/services http://www.symfony-project.org/schema/dic/services/services-1.0.xsd">
66

77
<parameters>
8-
<parameter key="data_collector.config.class">Symfony\Bundle\FrameworkBundle\DataCollector\ConfigDataCollector</parameter>
8+
<parameter key="data_collector.config.class">Symfony\Component\HttpKernel\DataCollector\ConfigDataCollector</parameter>
99
<parameter key="data_collector.request.class">Symfony\Bundle\FrameworkBundle\DataCollector\RequestDataCollector</parameter>
1010
<parameter key="data_collector.exception.class">Symfony\Component\HttpKernel\DataCollector\ExceptionDataCollector</parameter>
1111
<parameter key="data_collector.events.class">Symfony\Component\HttpKernel\DataCollector\EventDataCollector</parameter>
@@ -18,7 +18,6 @@
1818
<service id="data_collector.config" class="%data_collector.config.class%" public="false">
1919
<tag name="data_collector" template="WebProfilerBundle:Collector:config" id="config" priority="255" />
2020
<argument type="service" id="kernel" />
21-
<argument type="service" id="router" on-invalid="ignore" />
2221
</service>
2322

2423
<service id="data_collector.request" class="%data_collector.request.class%" public="false">

src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,18 @@ public function toolbarAction($token, $position = null)
149149
$position = false === strpos($this->container->get('request')->headers->get('user-agent'), 'Mobile') ? 'fixed' : 'absolute';
150150
}
151151

152+
$url = null;
153+
try {
154+
$url = $this->container->get('router')->generate('_profiler', array('token' => $token));
155+
} catch (\Exception $e) {
156+
// the profiler is not enabled
157+
}
158+
152159
return $this->container->get('templating')->renderResponse('WebProfilerBundle:Profiler:toolbar.html.twig', array(
153-
'position' => $position,
154-
'profiler' => $profiler,
155-
'templates' => $this->getTemplates($profiler),
160+
'position' => $position,
161+
'profiler' => $profiler,
162+
'templates' => $this->getTemplates($profiler),
163+
'profiler_url' => $url,
156164
));
157165
}
158166

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/config.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@
88
{{ 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>
99

1010
<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=" />
11-
{{ 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 %}
11+
{{ 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 %}
1212
{% endblock %}

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
{% endif %}
2323
>
2424
{% for name, template in templates %}
25-
{{ template.renderblock('toolbar', { 'collector': profiler.get(name) }) }}
25+
{{ template.renderblock('toolbar', { 'collector': profiler.get(name), 'profiler_url': profiler_url }) }}
2626
{% endfor %}
2727
{% if 'normal' != position %}
2828
<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';" />

src/Symfony/Bundle/FrameworkBundle/DataCollector/ConfigDataCollector.php renamed to src/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,13 @@
99
* file that was distributed with this source code.
1010
*/
1111

12-
namespace Symfony\Bundle\FrameworkBundle\DataCollector;
12+
namespace Symfony\Component\HttpKernel\DataCollector;
1313

1414
use Symfony\Component\HttpKernel\KernelInterface;
1515
use Symfony\Component\HttpKernel\Kernel;
1616
use Symfony\Component\HttpKernel\DataCollector\DataCollector;
1717
use Symfony\Component\HttpFoundation\Request;
1818
use Symfony\Component\HttpFoundation\Response;
19-
use Symfony\Component\Routing\RouterInterface;
2019

2120
/**
2221
* ConfigDataCollector.
@@ -26,18 +25,15 @@
2625
class ConfigDataCollector extends DataCollector
2726
{
2827
protected $kernel;
29-
protected $router;
3028

3129
/**
3230
* Constructor.
3331
*
3432
* @param KernelInterface $kernel A KernelInterface instance
35-
* @param RouterInterface $router A RouterInterface instance
3633
*/
37-
public function __construct(KernelInterface $kernel, RouterInterface $router = null)
34+
public function __construct(KernelInterface $kernel)
3835
{
3936
$this->kernel = $kernel;
40-
$this->router = $router;
4137
}
4238

4339
/**
@@ -63,24 +59,6 @@ public function collect(Request $request, Response $response, \Exception $except
6359
);
6460
}
6561

66-
/**
67-
* Gets the URL.
68-
*
69-
* @return string The URL
70-
*/
71-
public function getUrl()
72-
{
73-
if (null !== $this->router) {
74-
try {
75-
return $this->router->generate('_profiler', array('token' => $this->data['token']));
76-
} catch (\Exception $e) {
77-
// the route is not registered
78-
}
79-
}
80-
81-
return false;
82-
}
83-
8462
/**
8563
* Gets the token.
8664
*

src/Symfony/Component/HttpKernel/Profiler/SqliteProfilerStorage.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,9 @@ protected function exec($db, $query, array $args = array())
157157
}
158158

159159
$res = $stmt->execute();
160+
if (false === $res) {
161+
throw new \RuntimeException(sprintf('Error executing SQLite query "%s"', $query));
162+
}
160163
$res->finalize();
161164
} else {
162165
foreach ($args as $arg => $val) {

0 commit comments

Comments
 (0)