8000 [2.3] [WebProfiler] added the possibility to override the application name/version in the WDT by fabpot · Pull Request #7003 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[2.3] [WebProfiler] added the possibility to override the application name/version in the WDT #7003

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 23, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
10000
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,26 @@
{% set icon %}
<a href="http://symfony.com/">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it me sense to have this configurable ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vicb IMO I think yes... Think about other sf2 framework distributions eg: knp rad edition, it would be good to refer to them when user use their sf2 mix

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with @canni on this one.

<img width="26" height="28" alt="Symfony" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABoAAAAcCAMAAABIzV/hAAACZFBMVEUwLjL///////////////////////////////////////////////////////////////////+Eg4b///+Ni46Xlpj///////////+op6n///////////////////////////////////////////////////////////9ZWFv///////9qaWz///////+mpaf///////////////9ZWFv///////////////9PTVH///91dHb////////////////////g4OD///9NTE+Ih4r///////+Ni47///////92dHeRkJLk5OTLy8xlY2b///////+cm53///////+5ubr////o6Oj////////U1NT///9DQURsa22rq6ysq61hX2L///+LioxTUVVBP0NEQkZpZ2rGxsf///9ram3////s7O2SkZNfXmFxcHKmpae4uLnKysuXlpiop6l3dXiIh4pYVlmrq6ycm52trK7Nzc48Oj5dW158e36dnJ49Oz/Pz9BiYGPAv8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3fSOCN8PZnQynEW5W/nmHy0PXv79eHpRSjsjtEOtWZcRc9YXlNx7VFKwceGYHjG6s0Ob3iK+X3LqlKnjkvt39rjD6w3W6BhvrCdaVw//ADrWicJIvtkmAAAAAElFTkSuQmCC"/>
<span>{{ collector.symfonyversion }}</span>
<span>
{% if collector.applicationname %}
{{ collector.applicationname }} {{ collector.applicationversion }}
{% else %}
{{ collector.symfonyversion }}
{% endif %}
</span>
</a>
{% endset %}
{% set text %}
{% if collector.applicationname %}
<div class="sf-toolbar-info-piece">
{{ collector.applicationname }} <b>{{ collector.applicationversion }}</b>
</div>
{% endif %}
<div class="sf-toolbar-info-piece">
Symfony <b>{{ collector.symfonyversion }}</b>
</div>
<div class="sf-toolbar-info-piece">
<a href="http://symfony.com/doc/{{ collector.symfonyversion }}/index.html" rel="help">Documentation</a>
<a href="http://symfony.com/doc/{{ collector.symfonyversion }}/index.html" rel="help">Symfony Documentation</a>
</div>
{% endset %}
{% include '@WebProfiler/Profiler/toolbar_item.html.twig' with { 'link': false } %}
Expand Down Expand Up @@ -97,8 +108,13 @@
<th>Value</th>
</tr>
<tr>
<th>Symfony version</th>
<td>{{ collector.symfonyversion }}</td>
{% if collector.applicationname %}
<th>Application</th>
<td>{{ collector.applicationname }} {{ collector.applicationversion }} (on Symfony {{ collector.symfonyversion }})</td>
{% else %}
<th>Symfony version</th>
<td>{{ collector.symfonyversion }}</td>
{% endif %}
</tr>
<tr>
<th>Application name</th>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,24 @@
class ConfigDataCollector extends DataCollector
{
private $kernel;
private $name;
private $version;

/**
* Constructor.
*
* @param string $name The name of the application using the web profiler
* @param string $version The version of the application using the web profiler
*/
public function __construct($name = null, $version = null)
{
$this->name = $name;
$this->version = $version;
}

/**
* Sets the Kernel associated with this Request.
*
* @param KernelInterface $kernel A KernelInterface instance
*/
public function setKernel(KernelInterface $kernel = null)
Expand All @@ -42,6 +56,8 @@ public function setKernel(KernelInterface $kernel = null)
public function collect(Request $request, Response $response, \Exception $exception = null)
{
$this->data = array(
'app_name' => $this->name,
'app_version' => $this->version,
'token' => $response->headers->get('X-Debug-Token'),
'symfony_version' => Kernel::VERSION,
'name' => isset($this->kernel) ? $this->kernel->getName() : 'n/a',
Expand All @@ -64,6 +80,16 @@ public function collect(Request $request, Response $response, \Exception $except
}
}

public function getApplicationName()
{
return $this->data['app_name'];
}

public function getApplicationVersion()
{
return $this->data['app_version'];
}

/**
* Gets the token.
*
Expand Down
0