Remove profiler storages

This commit is contained in:
Javier Eguiluz 2015-09-27 16:46:30 +02:00 committed by Fabien Potencier
parent b630972379
commit 83b2d7c53b
15 changed files with 154 additions and 53 deletions

View File

@ -170,7 +170,7 @@ Form
} }
``` ```
If your extension has to be compatible with Symfony 2.3-2.8, use the If your extension has to be compatible with Symfony 2.3-2.8, use the
following statement: following statement:
```php ```php
@ -332,66 +332,81 @@ DependencyInjection
WebProfiler WebProfiler
----------- -----------
The `profiler:import` and `profiler:export` commands have been deprecated and * The `profiler:import` and `profiler:export` commands have been deprecated and
will be removed in 3.0. will be removed in 3.0.
The web development toolbar has been completely redesigned. This update has * The web development toolbar has been completely redesigned. This update has
introduced some changes in the HTML markup of the toolbar items. introduced some changes in the HTML markup of the toolbar items.
Before: Before:
Information was wrapped with simple `<span>` elements: Information was wrapped with simple `<span>` elements:
```twig ```twig
{% block toolbar %} {% block toolbar %}
{% set icon %} {% set icon %}
<span> <span>
<svg ...></svg> <svg ...></svg>
<span>{{ '%.1f'|format(collector.memory / 1024 / 1024) }} MB</span> <span>{{ '%.1f'|format(collector.memory / 1024 / 1024) }} MB</span>
</span> </span>
{% endset %} {% endset %}
{% endblock %} {% endblock %}
``` ```
After: After:
Information is now semantically divided into values and labels according to Information is now semantically divided into values and labels according to
the `class` attribute of each `<span>` element: the `class` attribute of each `<span>` element:
```twig ```twig
{% block toolbar %} {% block toolbar %}
{% set icon %} {% set icon %}
<svg ...></svg> <svg ...></svg>
<span class="sf-toolbar-value"> <span class="sf-toolbar-value">
{{ '%.1f'|format(collector.memory / 1024 / 1024) }} {{ '%.1f'|format(collector.memory / 1024 / 1024) }}
</span> </span>
<span class="sf-toolbar-label">MB</span> <span class="sf-toolbar-label">MB</span>
{% endset %} {% endset %}
{% endblock %} {% endblock %}
``` ```
Most of the blocks designed for the previous toolbar will still be displayed Most of the blocks designed for the previous toolbar will still be displayed
correctly. However, if you want to support both the old and the new toolbar, correctly. However, if you want to support both the old and the new toolbar,
it's better to make use of the new `profiler_markup_version` variable passed it's better to make use of the new `profiler_markup_version` variable passed
to the toolbar templates: to the toolbar templates:
```twig ```twig
{% block toolbar %} {% block toolbar %}
{% set profiler_markup_version = profiler_markup_version|default(1) %} {% set profiler_markup_version = profiler_markup_version|default(1) %}
{% set icon %} {% set icon %}
{% if profiler_markup_version == 1 %} {% if profiler_markup_version == 1 %}
{# code for the original toolbar #} {# code for the original toolbar #}
{% else %} {% else %}
{# code for the new toolbar (Symfony 2.8+) #} {# code for the new toolbar (Symfony 2.8+) #}
{% endif %} {% endif %}
{% endset %} {% endset %}
{% endblock %} {% endblock %}
``` ```
* All the profiler storages different than `FileProfilerStorage` have been
deprecated. The deprecated classes are:
- `Symfony\Component\HttpKernel\Profiler\BaseMemcacheProfilerStorage`
- `Symfony\Component\HttpKernel\Profiler\MemcachedProfilerStorage`
- `Symfony\Component\HttpKernel\Profiler\MemcacheProfilerStorage`
- `Symfony\Component\HttpKernel\Profiler\MongoDbProfilerStorage`
- `Symfony\Component\HttpKernel\Profiler\MysqlProfilerStorage`
- `Symfony\Component\HttpKernel\Profiler\PdoProfilerStorage`
- `Symfony\Component\HttpKernel\Profiler\RedisProfilerStorage`
- `Symfony\Component\HttpKernel\Profiler\SqliteProfilerStorage`
The alternative solution is to use the `FileProfilerStorage` or create your
own storage implementing the `ProfileStorageInterface`.
FrameworkBundle FrameworkBundle
--------------- ---------------
@ -448,7 +463,7 @@ Config
* The `\Symfony\Component\Config\Resource\ResourceInterface::isFresh()` method has been * The `\Symfony\Component\Config\Resource\ResourceInterface::isFresh()` method has been
deprecated and will be removed in Symfony 3.0 because it assumes that resource deprecated and will be removed in Symfony 3.0 because it assumes that resource
implementations are able to check themselves for freshness. implementations are able to check themselves for freshness.
If you have custom resources that implement this method, change them to implement the If you have custom resources that implement this method, change them to implement the
`\Symfony\Component\Config\Resource\SelfCheckingResourceInterface` sub-interface instead `\Symfony\Component\Config\Resource\SelfCheckingResourceInterface` sub-interface instead
@ -470,6 +485,6 @@ Config
class MyCustomResource implements SelfCheckingResourceInterface { ... } class MyCustomResource implements SelfCheckingResourceInterface { ... }
``` ```
Additionally, if you have implemented cache validation strategies *using* `isFresh()` Additionally, if you have implemented cache validation strategies *using* `isFresh()`
yourself, you should have a look at the new cache validation system based on yourself, you should have a look at the new cache validation system based on
`ResourceChecker`s. `ResourceChecker`s.

View File

@ -272,9 +272,39 @@ class Configuration implements ConfigurationInterface
->booleanNode('collect')->defaultTrue()->end() ->booleanNode('collect')->defaultTrue()->end()
->booleanNode('only_exceptions')->defaultFalse()->end() ->booleanNode('only_exceptions')->defaultFalse()->end()
->booleanNode('only_master_requests')->defaultFalse()->end() ->booleanNode('only_master_requests')->defaultFalse()->end()
->scalarNode('dsn')->defaultValue('file:%kernel.cache_dir%/profiler')->end() ->scalarNode('dsn')
->scalarNode('username')->defaultValue('')->end() ->defaultValue('file:%kernel.cache_dir%/profiler')
->scalarNode('password')->defaultValue('')->end() ->beforeNormalization()
->ifTrue(function ($v) { return 'file:' !== substr($v, 0, 5); })
->then(function ($v) {
@trigger_error('The profiler.dsn configuration key must start with "file:" because all the storages except the filesystem are deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
return $v;
})
->end()
->end()
->scalarNode('username')
->defaultValue('')
->beforeNormalization()
->always()
->then(function ($v) {
@trigger_error('The profiler.username configuration key is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
return $v;
})
->end()
->end()
->scalarNode('password')
->defaultValue('')
->beforeNormalization()
->always()
->then(function ($v) {
@trigger_error('The profiler.password configuration key is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
return $v;
})
->end()
->end()
->scalarNode('lifetime')->defaultValue(86400)->end() ->scalarNode('lifetime')->defaultValue(86400)->end()
->arrayNode('matcher') ->arrayNode('matcher')
->canBeUnset() ->canBeUnset()

View File

@ -11,10 +11,15 @@
namespace Symfony\Component\HttpKernel\Profiler; namespace Symfony\Component\HttpKernel\Profiler;
@trigger_error('The '.__NAMESPACE__.'\BaseMemcacheProfilerStorage class is deprecated since Symfony 2.8 and will be removed in 3.0. Use FileProfilerStorage instead.', E_USER_DEPRECATED);
/** /**
* Base Memcache storage for profiling information in a Memcache. * Base Memcache storage for profiling information in a Memcache.
* *
* @author Andrej Hudec <pulzarraider@gmail.com> * @author Andrej Hudec <pulzarraider@gmail.com>
*
* @deprecated Deprecated since Symfony 2.8, to be removed in Symfony 3.0.
* Use {@link FileProfilerStorage} instead.
*/ */
abstract class BaseMemcacheProfilerStorage implements ProfilerStorageInterface abstract class BaseMemcacheProfilerStorage implements ProfilerStorageInterface
{ {

View File

@ -11,10 +11,15 @@
namespace Symfony\Component\HttpKernel\Profiler; namespace Symfony\Component\HttpKernel\Profiler;
@trigger_error('The '.__NAMESPACE__.'\MemcacheProfilerStorage class is deprecated since Symfony 2.8 and will be removed in 3.0. Use FileProfilerStorage instead.', E_USER_DEPRECATED);
/** /**
* Memcache Profiler Storage. * Memcache Profiler Storage.
* *
* @author Andrej Hudec <pulzarraider@gmail.com> * @author Andrej Hudec <pulzarraider@gmail.com>
*
* @deprecated Deprecated since Symfony 2.8, to be removed in Symfony 3.0.
* Use {@link FileProfilerStorage} instead.
*/ */
class MemcacheProfilerStorage extends BaseMemcacheProfilerStorage class MemcacheProfilerStorage extends BaseMemcacheProfilerStorage
{ {

View File

@ -11,10 +11,15 @@
namespace Symfony\Component\HttpKernel\Profiler; namespace Symfony\Component\HttpKernel\Profiler;
@trigger_error('The '.__NAMESPACE__.'\MemcachedProfilerStorage class is deprecated since Symfony 2.8 and will be removed in 3.0. Use FileProfilerStorage instead.', E_USER_DEPRECATED);
/** /**
* Memcached Profiler Storage. * Memcached Profiler Storage.
* *
* @author Andrej Hudec <pulzarraider@gmail.com> * @author Andrej Hudec <pulzarraider@gmail.com>
*
* @deprecated Deprecated since Symfony 2.8, to be removed in Symfony 3.0.
* Use {@link FileProfilerStorage} instead.
*/ */
class MemcachedProfilerStorage extends BaseMemcacheProfilerStorage class MemcachedProfilerStorage extends BaseMemcacheProfilerStorage
{ {

View File

@ -11,6 +11,12 @@
namespace Symfony\Component\HttpKernel\Profiler; namespace Symfony\Component\HttpKernel\Profiler;
@trigger_error('The '.__NAMESPACE__.'\MongoDbProfilerStorage class is deprecated since Symfony 2.8 and will be removed in 3.0. Use FileProfilerStorage instead.', E_USER_DEPRECATED);
/**
* @deprecated Deprecated since Symfony 2.8, to be removed in Symfony 3.0.
* Use {@link FileProfilerStorage} instead.
*/
class MongoDbProfilerStorage implements ProfilerStorageInterface class MongoDbProfilerStorage implements ProfilerStorageInterface
{ {
protected $dsn; protected $dsn;

View File

@ -11,10 +11,15 @@
namespace Symfony\Component\HttpKernel\Profiler; namespace Symfony\Component\HttpKernel\Profiler;
@trigger_error('The '.__NAMESPACE__.'\MysqlProfilerStorage class is deprecated since Symfony 2.8 and will be removed in 3.0. Use FileProfilerStorage instead.', E_USER_DEPRECATED);
/** /**
* A ProfilerStorage for Mysql. * A ProfilerStorage for Mysql.
* *
* @author Jan Schumann <js@schumann-it.com> * @author Jan Schumann <js@schumann-it.com>
*
* @deprecated Deprecated since Symfony 2.8, to be removed in Symfony 3.0.
* Use {@link FileProfilerStorage} instead.
*/ */
class MysqlProfilerStorage extends PdoProfilerStorage class MysqlProfilerStorage extends PdoProfilerStorage
{ {

View File

@ -11,11 +11,16 @@
namespace Symfony\Component\HttpKernel\Profiler; namespace Symfony\Component\HttpKernel\Profiler;
@trigger_error('The '.__NAMESPACE__.'\PdoProfilerStorage class is deprecated since Symfony 2.8 and will be removed in 3.0. Use FileProfilerStorage instead.', E_USER_DEPRECATED);
/** /**
* Base PDO storage for profiling information in a PDO database. * Base PDO storage for profiling information in a PDO database.
* *
* @author Fabien Potencier <fabien@symfony.com> * @author Fabien Potencier <fabien@symfony.com>
* @author Jan Schumann <js@schumann-it.com> * @author Jan Schumann <js@schumann-it.com>
*
* @deprecated Deprecated since Symfony 2.8, to be removed in Symfony 3.0.
* Use {@link FileProfilerStorage} instead.
*/ */
abstract class PdoProfilerStorage implements ProfilerStorageInterface abstract class PdoProfilerStorage implements ProfilerStorageInterface
{ {

View File

@ -11,11 +11,16 @@
namespace Symfony\Component\HttpKernel\Profiler; namespace Symfony\Component\HttpKernel\Profiler;
@trigger_error('The '.__NAMESPACE__.'\RedisProfilerStorage class is deprecated since Symfony 2.8 and will be removed in 3.0. Use FileProfilerStorage instead.', E_USER_DEPRECATED);
/** /**
* RedisProfilerStorage stores profiling information in Redis. * RedisProfilerStorage stores profiling information in Redis.
* *
* @author Andrej Hudec <pulzarraider@gmail.com> * @author Andrej Hudec <pulzarraider@gmail.com>
* @author Stephane PY <py.stephane1@gmail.com> * @author Stephane PY <py.stephane1@gmail.com>
*
* @deprecated Deprecated since Symfony 2.8, to be removed in Symfony 3.0.
* Use {@link FileProfilerStorage} instead.
*/ */
class RedisProfilerStorage implements ProfilerStorageInterface class RedisProfilerStorage implements ProfilerStorageInterface
{ {

View File

@ -11,10 +11,15 @@
namespace Symfony\Component\HttpKernel\Profiler; namespace Symfony\Component\HttpKernel\Profiler;
@trigger_error('The '.__NAMESPACE__.'\SqliteProfilerStorage class is deprecated since Symfony 2.8 and will be removed in 3.0. Use FileProfilerStorage instead.', E_USER_DEPRECATED);
/** /**
* SqliteProfilerStorage stores profiling information in a SQLite database. * SqliteProfilerStorage stores profiling information in a SQLite database.
* *
* @author Fabien Potencier <fabien@symfony.com> * @author Fabien Potencier <fabien@symfony.com>
*
* @deprecated Deprecated since Symfony 2.8, to be removed in Symfony 3.0.
* Use {@link FileProfilerStorage} instead.
*/ */
class SqliteProfilerStorage extends PdoProfilerStorage class SqliteProfilerStorage extends PdoProfilerStorage
{ {

View File

@ -14,6 +14,9 @@ namespace Symfony\Component\HttpKernel\Tests\Profiler;
use Symfony\Component\HttpKernel\Profiler\MemcacheProfilerStorage; use Symfony\Component\HttpKernel\Profiler\MemcacheProfilerStorage;
use Symfony\Component\HttpKernel\Tests\Profiler\Mock\MemcacheMock; use Symfony\Component\HttpKernel\Tests\Profiler\Mock\MemcacheMock;
/**
* @group legacy
*/
class MemcacheProfilerStorageTest extends AbstractProfilerStorageTest class MemcacheProfilerStorageTest extends AbstractProfilerStorageTest
{ {
protected static $storage; protected static $storage;

View File

@ -14,6 +14,9 @@ namespace Symfony\Component\HttpKernel\Tests\Profiler;
use Symfony\Component\HttpKernel\Profiler\MemcachedProfilerStorage; use Symfony\Component\HttpKernel\Profiler\MemcachedProfilerStorage;
use Symfony\Component\HttpKernel\Tests\Profiler\Mock\MemcachedMock; use Symfony\Component\HttpKernel\Tests\Profiler\Mock\MemcachedMock;
/**
* @group legacy
*/
class MemcachedProfilerStorageTest extends AbstractProfilerStorageTest class MemcachedProfilerStorageTest extends AbstractProfilerStorageTest
{ {
protected static $storage; protected static $storage;

View File

@ -47,6 +47,9 @@ class MongoDbProfilerStorageTestDataCollector extends DataCollector
} }
} }
/**
* @group legacy
*/
class MongoDbProfilerStorageTest extends AbstractProfilerStorageTest class MongoDbProfilerStorageTest extends AbstractProfilerStorageTest
{ {
protected static $storage; protected static $storage;

View File

@ -14,6 +14,9 @@ namespace Symfony\Component\HttpKernel\Tests\Profiler;
use Symfony\Component\HttpKernel\Profiler\RedisProfilerStorage; use Symfony\Component\HttpKernel\Profiler\RedisProfilerStorage;
use Symfony\Component\HttpKernel\Tests\Profiler\Mock\RedisMock; use Symfony\Component\HttpKernel\Tests\Profiler\Mock\RedisMock;
/**
* @group legacy
*/
class RedisProfilerStorageTest extends AbstractProfilerStorageTest class RedisProfilerStorageTest extends AbstractProfilerStorageTest
{ {
protected static $storage; protected static $storage;

View File

@ -13,6 +13,9 @@ namespace Symfony\Component\HttpKernel\Tests\Profiler;
use Symfony\Component\HttpKernel\Profiler\SqliteProfilerStorage; use Symfony\Component\HttpKernel\Profiler\SqliteProfilerStorage;
/**
* @group legacy
*/
class SqliteProfilerStorageTest extends AbstractProfilerStorageTest class SqliteProfilerStorageTest extends AbstractProfilerStorageTest
{ {
protected static $dbFile; protected static $dbFile;