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:
```php
@ -332,66 +332,81 @@ DependencyInjection
WebProfiler
-----------
The `profiler:import` and `profiler:export` commands have been deprecated and
will be removed in 3.0.
* The `profiler:import` and `profiler:export` commands have been deprecated and
will be removed in 3.0.
The web development toolbar has been completely redesigned. This update has
introduced some changes in the HTML markup of the toolbar items.
* The web development toolbar has been completely redesigned. This update has
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
{% block toolbar %}
{% set icon %}
<span>
<svg ...></svg>
<span>{{ '%.1f'|format(collector.memory / 1024 / 1024) }} MB</span>
</span>
{% endset %}
{% endblock %}
```
```twig
{% block toolbar %}
{% set icon %}
<span>
<svg ...></svg>
<span>{{ '%.1f'|format(collector.memory / 1024 / 1024) }} MB</span>
</span>
{% endset %}
{% endblock %}
```
After:
After:
Information is now semantically divided into values and labels according to
the `class` attribute of each `<span>` element:
Information is now semantically divided into values and labels according to
the `class` attribute of each `<span>` element:
```twig
{% block toolbar %}
{% set icon %}
<svg ...></svg>
<span class="sf-toolbar-value">
{{ '%.1f'|format(collector.memory / 1024 / 1024) }}
</span>
<span class="sf-toolbar-label">MB</span>
{% endset %}
{% endblock %}
```
```twig
{% block toolbar %}
{% set icon %}
<svg ...></svg>
<span class="sf-toolbar-value">
{{ '%.1f'|format(collector.memory / 1024 / 1024) }}
</span>
<span class="sf-toolbar-label">MB</span>
{% endset %}
{% endblock %}
```
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,
it's better to make use of the new `profiler_markup_version` variable passed
to the toolbar templates:
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,
it's better to make use of the new `profiler_markup_version` variable passed
to the toolbar templates:
```twig
{% block toolbar %}
{% set profiler_markup_version = profiler_markup_version|default(1) %}
```twig
{% block toolbar %}
{% set profiler_markup_version = profiler_markup_version|default(1) %}
{% set icon %}
{% if profiler_markup_version == 1 %}
{% set icon %}
{% 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 %}
{% endset %}
{% endblock %}
```
{% endif %}
{% endset %}
{% 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
---------------
@ -448,7 +463,7 @@ Config
* The `\Symfony\Component\Config\Resource\ResourceInterface::isFresh()` method has been
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
`\Symfony\Component\Config\Resource\SelfCheckingResourceInterface` sub-interface instead
@ -470,6 +485,6 @@ Config
class MyCustomResource implements SelfCheckingResourceInterface { ... }
```
Additionally, if you have implemented cache validation strategies *using* `isFresh()`
yourself, you should have a look at the new cache validation system based on
Additionally, if you have implemented cache validation strategies *using* `isFresh()`
yourself, you should have a look at the new cache validation system based on
`ResourceChecker`s.

View File

@ -272,9 +272,39 @@ class Configuration implements ConfigurationInterface
->booleanNode('collect')->defaultTrue()->end()
->booleanNode('only_exceptions')->defaultFalse()->end()
->booleanNode('only_master_requests')->defaultFalse()->end()
->scalarNode('dsn')->defaultValue('file:%kernel.cache_dir%/profiler')->end()
->scalarNode('username')->defaultValue('')->end()
->scalarNode('password')->defaultValue('')->end()
->scalarNode('dsn')
->defaultValue('file:%kernel.cache_dir%/profiler')
->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()
->arrayNode('matcher')
->canBeUnset()

View File

@ -11,10 +11,15 @@
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.
*
* @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
{

View File

@ -11,10 +11,15 @@
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.
*
* @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
{

View File

@ -11,10 +11,15 @@
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.
*
* @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
{

View File

@ -11,6 +11,12 @@
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
{
protected $dsn;

View File

@ -11,10 +11,15 @@
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.
*
* @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
{

View File

@ -11,11 +11,16 @@
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.
*
* @author Fabien Potencier <fabien@symfony.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
{

View File

@ -11,11 +11,16 @@
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.
*
* @author Andrej Hudec <pulzarraider@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
{

View File

@ -11,10 +11,15 @@
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.
*
* @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
{

View File

@ -14,6 +14,9 @@ namespace Symfony\Component\HttpKernel\Tests\Profiler;
use Symfony\Component\HttpKernel\Profiler\MemcacheProfilerStorage;
use Symfony\Component\HttpKernel\Tests\Profiler\Mock\MemcacheMock;
/**
* @group legacy
*/
class MemcacheProfilerStorageTest extends AbstractProfilerStorageTest
{
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\Tests\Profiler\Mock\MemcachedMock;
/**
* @group legacy
*/
class MemcachedProfilerStorageTest extends AbstractProfilerStorageTest
{
protected static $storage;

View File

@ -47,6 +47,9 @@ class MongoDbProfilerStorageTestDataCollector extends DataCollector
}
}
/**
* @group legacy
*/
class MongoDbProfilerStorageTest extends AbstractProfilerStorageTest
{
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\Tests\Profiler\Mock\RedisMock;
/**
* @group legacy
*/
class RedisProfilerStorageTest extends AbstractProfilerStorageTest
{
protected static $storage;

View File

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