Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Added Session Metadata info to the Request section of the WDT

  • Loading branch information...
commit 8dd2af77a43af6099be4bd4b8b5e7ed59e4dede9 1 parent 9e95199
Florin Patan dlsniper authored
14 src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/request.html.twig
@@ -34,6 +34,10 @@
34 34 <b>Route name</b>
35 35 <span>{{ request_route }}</span>
36 36 </div>
  37 + <div class="sf-toolbar-info-piece">
  38 + <b>Has session</b>
  39 + <span>{% if collector.sessionmetadata|length %}yes{% else %}no{% endif %}</span>
  40 + </div>
37 41 {% endspaceless %}
38 42 {% endset %}
39 43 {% include 'WebProfilerBundle:Profiler:toolbar_item.html.twig' with { 'link': profiler_url } %}
@@ -109,6 +113,16 @@
109 113
110 114 {% include 'WebProfilerBundle:Profiler:bag.html.twig' with { 'bag': collector.responseheaders } only %}
111 115
  116 + <h2>Session Metadata</h2>
  117 +
  118 + {% if collector.sessionmetadata|length %}
  119 + {% include 'WebProfilerBundle:Profiler:table.html.twig' with { 'data': collector.sessionmetadata } only %}
  120 + {% else %}
  121 + <p>
  122 + <em>No session metadata</em>
  123 + </p>
  124 + {% endif %}
  125 +
112 126 <h2>Session Attributes</h2>
113 127
114 128 {% if collector.sessionattributes|length %}
14 src/Symfony/Component/HttpKernel/DataCollector/RequestDataCollector.php
@@ -59,6 +59,14 @@ public function collect(Request $request, Response $response, \Exception $except
59 59 $content = false;
60 60 }
61 61
  62 + $sessionMetadata = array();
  63 +
  64 + if ($request->hasSession()) {
  65 + $sessionMetadata['Created'] = date(DATE_RFC822, $request->getSession()->getMetadataBag()->getCreated());
  66 + $sessionMetadata['Last used'] = date(DATE_RFC822, $request->getSession()->getMetadataBag()->getLastUsed());
  67 + $sessionMetadata['Lifetime'] = $request->getSession()->getMetadataBag()->getLifetime();
  68 + }
  69 +
62 70 $this->data = array(
63 71 'format' => $request->getRequestFormat(),
64 72 'content' => $content,
@@ -71,6 +79,7 @@ public function collect(Request $request, Response $response, \Exception $except
71 79 'request_cookies' => $request->cookies->all(),
72 80 'request_attributes' => $attributes,
73 81 'response_headers' => $responseHeaders,
  82 + 'session_metadata' => $sessionMetadata,
74 83 'session_attributes' => $request->hasSession() ? $request->getSession()->all() : array(),
75 84 'flashes' => $request->hasSession() ? $request->getSession()->getFlashBag()->peekAll() : array(),
76 85 'path_info' => $request->getPathInfo(),
@@ -117,6 +126,11 @@ public function getResponseHeaders()
117 126 return new ResponseHeaderBag($this->data['response_headers']);
118 127 }
119 128
  129 + public function getSessionMetadata()
  130 + {
  131 + return $this->data['session_metadata'];
  132 + }
  133 +
120 134 public function getSessionAttributes()
121 135 {
122 136 return $this->data['session_attributes'];

0 comments on commit 8dd2af7

Please sign in to comment.
Something went wrong with that request. Please try again.