Skip to content

Commit

Permalink
Symfony 4 support
Browse files Browse the repository at this point in the history
  • Loading branch information
javer committed Jun 7, 2018
1 parent 35b25ab commit bc7df5f
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 9 deletions.
4 changes: 3 additions & 1 deletion DataCollector/SphinxDataCollector.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ public function getQueriesTime(): float
*/
public function reset()
{
$this->data = array();
$this->data = [];

$this->logger->reset();
}

/**
Expand Down
11 changes: 11 additions & 0 deletions Logger/SphinxLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,15 @@ public function getQueriesTime(): float
{
return $this->queriesTime;
}

/**
* Resets internal state.
*/
public function reset()
{
$this->queries = [];
$this->queriesCount = 0;
$this->queriesRows = 0;
$this->queriesTime = 0;
}
}
3 changes: 2 additions & 1 deletion Resources/config/services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ parameters:
services:
sphinx:
class: "%sphinx.manager.class%"
public: true
arguments:
- "@sphinx.logger"
- "%javer_sphinx.host%"
Expand All @@ -38,7 +39,7 @@ services:
arguments:
- "@sphinx.logger"
tags:
- { name: data_collector, template: "JaverSphinxBundle:Collector:sphinx.html.twig", id: sphinx }
- { name: data_collector, template: "@JaverSphinx/Collector/sphinx.html.twig", id: sphinx }

sphinx.daemon:
class: "%sphinx.daemon.class%"
Expand Down
14 changes: 7 additions & 7 deletions Resources/views/Collector/sphinx.html.twig
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{% extends 'WebProfilerBundle:Profiler:layout.html.twig' %}
{% extends '@WebProfiler/Profiler/layout.html.twig' %}

{% block toolbar %}
{% set profiler_markup_version = profiler_markup_version|default(1) %}

{% if profiler_markup_version == 1 %}
{% set icon %}
{{ include('JaverSphinxBundle:Collector:icon.html.twig') }}
{{ include('@JaverSphinx/Collector/icon.html.twig') }}

<span class="sf-toolbar-status">{{ collector.queriesCount }}</span>
{% endset %}
Expand All @@ -22,10 +22,10 @@
</div>
{% endset %}

{% include 'WebProfilerBundle:Profiler:toolbar_item.html.twig' with { 'link': profiler_url, status: '' } %}
{% include '@WebProfiler/Profiler/toolbar_item.html.twig' with { 'link': profiler_url, status: '' } %}
{% elseif collector.queriesCount > 0 %}
{% set icon %}
{{ include('JaverSphinxBundle:Collector:icon.html.twig') }}
{{ include('@JaverSphinx/Collector/icon.html.twig') }}

<span class="sf-toolbar-value">{{ collector.queriesCount }}</span>
<span class="sf-toolbar-info-piece-additional-detail">
Expand All @@ -47,7 +47,7 @@
</div>
{% endset %}

{% include 'WebProfilerBundle:Profiler:toolbar_item.html.twig' with { 'link': profiler_url, status: '' } %}
{% include '@WebProfiler/Profiler/toolbar_item.html.twig' with { 'link': profiler_url, status: '' } %}
{% endif %}
{% endblock %}

Expand All @@ -56,7 +56,7 @@

{% if profiler_markup_version == 1 %}
<span class="label">
<span class="icon">{{ include('JaverSphinxBundle:Collector:icon.html.twig') }}</span>
<span class="icon">{{ include('@JaverSphinx/Collector/icon.html.twig') }}</span>
<strong>Sphinx</strong>
<span class="count">
<span>{{ collector.queriesCount }}</span>
Expand All @@ -65,7 +65,7 @@
</span>
{% else %}
<span class="label {{ collector.queriesCount == 0 ? 'disabled' }}">
<span class="icon">{{ include('JaverSphinxBundle:Collector:icon.html.twig') }}</span>
<span class="icon">{{ include('@JaverSphinx/Collector/icon.html.twig') }}</span>
<strong>Sphinx</strong>
<span class="count">
<span>{{ collector.queriesCount }}</span>
Expand Down

0 comments on commit bc7df5f

Please sign in to comment.