Skip to content

Remove profiler storages #15944

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

Closed
Closed
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
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
115 changes: 65 additions & 50 deletions UPGRADE-2.8.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:

```twig
{% block toolbar %}
{% set icon %}
<span>
<svg ...></svg>
<span>{{ '%.1f'|format(collector.memory / 1024 / 1024) }} MB</span>
</span>
{% endset %}
{% endblock %}
```

Information was wrapped with simple `<span>` elements:
After:

```twig
{% block toolbar %}
{% set icon %}
<span>
<svg ...></svg>
<span>{{ '%.1f'|format(collector.memory / 1024 / 1024) }} MB</span>
</span>
{% endset %}
{% endblock %}
```
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 %}
```

After:
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:

Information is now semantically divided into values and labels according to
the `class` attribute of each `<span>` element:
```twig
{% block toolbar %}
{% set profiler_markup_version = profiler_markup_version|default(1) %}

```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 %}
```
{% set icon %}
{% if profiler_markup_version == 1 %}

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:
{# code for the original toolbar #}

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

{% set icon %}
{% if profiler_markup_version == 1 %}
{# code for the new toolbar (Symfony 2.8+) #}

{# code for the original toolbar #}
{% endif %}
{% endset %}
{% endblock %}
```

{% else %}
* All the profiler storages different than `FileProfilerStorage` have been
deprecated. The deprecated classes are:

{# code for the new toolbar (Symfony 2.8+) #}
- `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`

{% endif %}
{% endset %}
{% endblock %}
```
The alternative solution is to use the `FileProfilerStorage` or create your
own storage implementing the `ProfileStorageInterface`.

FrameworkBundle
---------------
Expand Down Expand Up @@ -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
Expand All @@ -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.
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,39 @@ private function addProfilerSection(ArrayNodeDefinition $rootNode)
->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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Copy link
Member

Choose a reason for hiding this comment

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

this should also be triggered for child classes IMO, as they are also deprecated.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done. Thanks.


/**
* 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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
use Symfony\Component\HttpKernel\Profiler\MemcacheProfilerStorage;
use Symfony\Component\HttpKernel\Tests\Profiler\Mock\MemcacheMock;

/**
* @group legacy
*/
class MemcacheProfilerStorageTest extends AbstractProfilerStorageTest
{
protected static $storage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
use Symfony\Component\HttpKernel\Profiler\MemcachedProfilerStorage;
use Symfony\Component\HttpKernel\Tests\Profiler\Mock\MemcachedMock;

/**
* @group legacy
*/
class MemcachedProfilerStorageTest extends AbstractProfilerStorageTest
{
protected static $storage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ public function getName()
}
}

/**
* @group legacy
*/
class MongoDbProfilerStorageTest extends AbstractProfilerStorageTest
{
protected static $storage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
use Symfony\Component\HttpKernel\Profiler\RedisProfilerStorage;
use Symfony\Component\HttpKernel\Tests\Profiler\Mock\RedisMock;

/**
* @group legacy
*/
class RedisProfilerStorageTest extends AbstractProfilerStorageTest
{
protected static $storage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@

use Symfony\Component\HttpKernel\Profiler\SqliteProfilerStorage;

/**
* @group legacy
*/
class SqliteProfilerStorageTest extends AbstractProfilerStorageTest
{
protected static $dbFile;
Expand Down