8000 feature #15944 Remove profiler storages (javiereguiluz) · symfony/symfony@8f44cc3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8f44cc3

Browse files
committed
feature #15944 Remove profiler storages (javiereguiluz)
This PR was squashed before being merged into the 2.8 branch (closes #15944). Discussion ---------- Remove profiler storages | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | yes | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Commits ------- 83b2d7c Remove profiler storages
2 parents b258949 + 83b2d7c commit 8f44cc3

15 files changed

+154
-53
lines changed

UPGRADE-2.8.md

Lines changed: 65 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ Form
170170
}
171171
```
172172

173-
If your extension has to be compatible with Symfony 2.3-2.8, use the
173+
If your extension has to be compatible with Symfony 2.3-2.8, use the
174174
following statement:
175175

176176
```php
@@ -332,66 +332,81 @@ DependencyInjection
332332
WebProfiler
333333
-----------
334334

335-
The `profiler:import` and `profiler:export` commands have been deprecated and
336-
will be removed in 3.0.
335+
* The `profiler:import` and `profiler:export` commands have been deprecated and
336+
will be removed in 3.0.
337337

338-
The web development toolbar has been completely redesigned. This update has
339-
introduced some changes in the HTML markup of the toolbar items.
338+
* The web development toolbar has been completely redesigned. This update has
339+
introduced some changes in the HTML markup of the toolbar items.
340340

341-
Before:
341+
Before:
342+
343+
Information was wrapped with simple `<span>` elements:
344+
345+
```twig
346+
{% block toolbar %}
347+
{% set icon %}
348+
<span>
349+
<svg ...></svg>
350+
<span>{{ '%.1f'|format(collector.memory / 1024 / 1024) }} MB</span>
351+
</span>
352+
{% endset %}
353+
{% endblock %}
354+
```
342355

343-
Information was wrapped with simple `<span>` elements:
356+
After:
344357

345-
```twig
346-
{% block toolbar %}
347-
{% set icon %}
348-
<span>
349-
<svg ...></svg>
350-
<span>{{ '%.1f'|format(collector.memory / 1024 / 1024) }} MB</span>
351-
</span>
352-
{% endset %}
353-
{% endblock %}
354-
```
358+
Information is now semantically divided into values and labels according to
359+
the `class` attribute of each `<span>` element:
360+
361+
```twig
362+
{% block toolbar %}
363+
{% set icon %}
364+
<svg ...></svg>
365+
<span class="sf-toolbar-value">
366+
{{ '%.1f'|format(collector.memory / 1024 / 1024) }}
367+
</span>
368+
<span class="sf-toolbar-label">MB</span>
369+
{% endset %}
370+
{% endblock %}
371+
```
355372

356-
After:
373+
Most of the blocks designed for the previous toolbar will still be displayed
374+
correctly. However, if you want to support both the old and the new toolbar,
375+
it's better to make use of the new `profiler_markup_version` variable passed
376+
to the toolbar templates:
357377

358-
Information is now semantically divided into values and labels according to
359-
the `class` attribute of each `<span>` element:
378+
```twig
379+
{% block toolbar %}
380+
{% set profiler_markup_version = profiler_markup_version|default(1) %}
360381
361-
```twig
362-
{% block toolbar %}
363-
{% set icon %}
364-
<svg ...></svg>
365-
<span class="sf-toolbar-value">
366-
{{ '%.1f'|format(collector.memory / 1024 / 1024) }}
367-
</span>
368-
<span class="sf-toolbar-label">MB</span>
369-
{% endset %}
370-
{% endblock %}
371-
```
382+
{% set icon %}
383+
{% if profiler_markup_version == 1 %}
372384
373-
Most of the blocks designed for the previous toolbar will still be displayed
374-
correctly. However, if you want to support both the old and the new toolbar,
375-
it's better to make use of the new `profiler_markup_version` variable passed
376-
to the toolbar templates:
385+
{# code for the original toolbar #}
377386
378-
```twig
379-
{% block toolbar %}
380-
{% set profiler_markup_version = profiler_markup_version|default(1) %}
387+
{% else %}
381388
382-
{% set icon %}
383-
{% if profiler_markup_version == 1 %}
389+
{# code for the new toolbar (Symfony 2.8+) #}
384390
385-
{# code for the original toolbar #}
391+
{% endif %}
392+
{% endset %}
393+
{% endblock %}
394+
```
386395

387-
{% else %}
396+
* All the profiler storages different than `FileProfilerStorage` have been
397+
deprecated. The deprecated classes are:
388398

389-
{# code for the new toolbar (Symfony 2.8+) #}
399+
- `Symfony\Component\HttpKernel\Profiler\BaseMemcacheProfilerStorage`
400+
- `Symfony\Component\HttpKernel\Profiler\MemcachedProfilerStorage`
401+
- `Symfony\Component\HttpKernel\Profiler\MemcacheProfilerStorage`
402+
- `Symfony\Component\HttpKernel\Profiler\MongoDbProfilerStorage`
403+
- `Symfony\Component\HttpKernel\Profiler\MysqlProfilerStorage`
404+
- `Symfony\Component\HttpKernel\Profiler\PdoProfilerStorage`
405+
- `Symfony\Component\HttpKernel\Profiler\RedisProfilerStorage`
406+
- `Symfony\Component\HttpKernel\Profiler\SqliteProfilerStorage`
390407

391-
{% endif %}
392-
{% endset %}
393-
{% endblock %}
394-
```
408+
The alternative solution is to use the `FileProfilerStorage` or create your
409+
own storage implementing the `ProfileStorageInterface`.
395410

396411
FrameworkBundle
397412
---------------
@@ -448,7 +463,7 @@ Config
448463

449464
* The `\Symfony\Component\Config\Resource\ResourceInterface::isFresh()` method has been
450465
deprecated and will be removed in Symfony 3.0 because it assumes that resource
451-
implementations are able to check themselves for freshness.
466+
implementations are able to check themselves for freshness.
452467

453468
If you have custom resources that implement this method, change them to implement the
454469
`\Symfony\Component\Config\Resource\SelfCheckingResourceInterface` sub-interface instead
@@ -470,6 +485,6 @@ Config
470485
class MyCustomResource implements SelfCheckingResourceInterface { ... }
471486
```
472487

473-
Additionally, if you have implemented cache validation strategies *using* `isFresh()`
474-
yourself, you should have a look at the new cache validation system based on
488+
Additionally, if you have implemented cache validation strategies *using* `isFresh()`
489+
yourself, you should have a look at the new cache validation system based on
475490
`ResourceChecker`s.

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -272,9 +272,39 @@ private function addProfilerSection(ArrayNodeDefinition $rootNode)
272272
->booleanNode('collect')->defaultTrue()->end()
273273
->booleanNode('only_exceptions')->defaultFalse()->end()
274274
->booleanNode('only_master_requests')->defaultFalse()->end()
275-
->scalarNode('dsn')->defaultValue('file:%kernel.cache_dir%/profiler')->end()
276-
->scalarNode('username')->defaultValue('')->end()
277-
->scalarNode('password')->defaultValue('')->end()
275+
->scalarNode('dsn')
276+
->defaultValue('file:%kernel.cache_dir%/profiler')
277+
->beforeNormalization()
278+
->ifTrue(function ($v) { return 'file:' !== substr($v, 0, 5); })
279+
->then(function ($v) {
280+
@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);
281+
282+
return $v;
283+
})
284+
->end()
285+
->end()
286+
->scalarNode('username')
287+
->defaultValue('')
288+
->beforeNormalization()
289+
->always()
290+
->then(function ($v) {
291+
@trigger_error('The profiler.username configuration key is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
292+
293+
return $v;
294+
})
295+
->end()
296+
->end()
297+
->scalarNode('password')
298+
->defaultValue('')
299+
->beforeNormalization()
300+
->always()
301+
->then(function ($v) {
302+
@trigger_error('The profiler.password configuration key is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
303+
304+
return $v;
305+
})
306+
->end()
307+
->end()
278308
->scalarNode('lifetime')->defaultValue(86400)->end()
279309
->arrayNode('matcher')
280310
->canBeUnset()

src/Symfony/Component/HttpKernel/Profiler/BaseMemcacheProfilerStorage.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,15 @@
1111

1212
namespace Symfony\Component\HttpKernel\Profiler;
1313

14+
@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);
15+
1416
/**
1517
* Base Memcache storage for profiling information in a Memcache.
1618
*
1719
* @author Andrej Hudec <pulzarraider@gmail.com>
20+
*
21+
* @deprecated Deprecated since Symfony 2.8, to be removed in Symfony 3.0.
22+
* Use {@link FileProfilerStorage} instead.
1823
*/
1924
abstract class BaseMemcacheProfilerStorage implements ProfilerStorageInterface
2025
{

src/Symfony/Component/HttpKernel/Profiler/MemcacheProfilerStorage.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,15 @@
1111

1212
namespace Symfony\Component\HttpKernel\Profiler;
1313

14+
@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);
15+
1416
/**
1517
* Memcache Profiler Storage.
1618
*
1719
* @author Andrej Hudec <pulzarraider@gmail.com>
20+
*
21+
* @deprecated Deprecated since Symfony 2.8, to be removed in Symfony 3.0.
22+
* Use {@link FileProfilerStorage} instead.
1823
*/
1924
class MemcacheProfilerStorage extends BaseMemcacheProfilerStorage
2025
{

src/Symfony/Component/HttpKernel/Profiler/MemcachedProfilerStorage.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,15 @@
1111

1212
namespace Symfony\Component\HttpKernel\Profiler;
1313

14+
@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);
15+
1416
/**
1517
* Memcached Profiler Storage.
1618
*
1719
* @author Andrej Hudec <pulzarraider@gmail.com>
20+
*
21+
* @deprecated Deprecated since Symfony 2.8, to be removed in Symfony 3.0.
22+
* Use {@link FileProfilerStorage} instead.
1823
*/
1924
class MemcachedProfilerStorage extends BaseMemcacheProfilerStorage
2025
{

src/Symfony/Component/HttpKernel/Profiler/MongoDbProfilerStorage.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@
1111

1212
namespace Symfony\Component\HttpKernel\Profiler;
1313

14+
@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);
15+
16+
/**
17+
* @deprecated Deprecated since Symfony 2.8, to be removed in Symfony 3.0.
18+
* Use {@link FileProfilerStorage} instead.
19+
*/
1420
class MongoDbProfilerStorage implements ProfilerStorageInterface
1521
{
1622
protected $dsn;

src/Symfony/Component/HttpKernel/Profiler/MysqlProfilerStorage.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,15 @@
1111

1212
namespace Symfony\Component\HttpKernel\Profiler;
1313

14+
@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);
15+
1416
/**
1517
* A ProfilerStorage for Mysql.
1618
*
1719
* @author Jan Schumann <js@schumann-it.com>
20+
*
21+
* @deprecated Deprecated since Symfony 2.8, to be removed in Symfony 3.0.
22+
* Use {@link FileProfilerStorage} instead.
1823
*/
1924
class MysqlProfilerStorage extends PdoProfilerStorage
2025
{

src/Symfony/Component/HttpKernel/Profiler/PdoProfilerStorage.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,16 @@
1111

1212
namespace Symfony\Component\HttpKernel\Profiler;
1313

14+
@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);
15+
1416
/**
1517
* Base PDO storage for profiling information in a PDO database.
1618
*
1719
* @author Fabien Potencier <fabien@symfony.com>
1820
* @author Jan Schumann <js@schumann-it.com>
21+
*
22+
* @deprecated Deprecated since Symfony 2.8, to be removed in Symfony 3.0.
23+
* Use {@link FileProfilerStorage} instead.
1924
*/
2025
abstract class PdoProfilerStorage implements ProfilerStorageInterface
2126
{

src/Symfony/Component/HttpKernel/Profiler/RedisProfilerStorage.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,16 @@
1111

1212
namespace Symfony\Component\HttpKernel\Profiler;
1313

14+
@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);
15+
1416
/**
1517
* RedisProfilerStorage stores profiling information in Redis.
1618
*
1719
* @author Andrej Hudec <pulzarraider@gmail.com>
1820
* @author Stephane PY <py.stephane1@gmail.com>
21+
*
22+
* @deprecated Deprecated since Symfony 2.8, to be removed in Symfony 3.0.
23+
* Use {@link FileProfilerStorage} instead.
1924
*/
2025
class RedisProfilerStorage implements ProfilerStorageInterface
2126
{

src/Symfony/Component/HttpKernel/Profiler/SqliteProfilerStorage.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,15 @@
1111

1212
namespace Symfony\Component\HttpKernel\Profiler;
1313

14+
@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);
15+
1416
/**
1517
* SqliteProfilerStorage stores profiling information in a SQLite database.
1618
*
1719
* @author Fabien Potencier <fabien@symfony.com>
20+
*
21+
* @deprecated Deprecated since Symfony 2.8, to be removed in Symfony 3.0.
22+
* Use {@link FileProfilerStorage} instead.
1823
*/
1924
class SqliteProfilerStorage extends PdoProfilerStorage
2025
{

src/Symfony/Component/HttpKernel/Tests/Profiler/MemcacheProfilerStorageTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
use Symfony\Component\HttpKernel\Profiler\MemcacheProfilerStorage;
1515
use Symfony\Component\HttpKernel\Tests\Profiler\Mock\MemcacheMock;
1616

17+
/**
18+
* @group legacy
19+
*/
1720
class MemcacheProfilerStorageTest extends AbstractProfilerStorageTest
1821
{
1922
protected static $storage;

src/Symfony/Component/HttpKernel/Tests/Profiler/MemcachedProfilerStorageTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
use Symfony\Component\HttpKernel\Profiler\MemcachedProfilerStorage;
1515
use Symfony\Component\HttpKernel\Tests\Profiler\Mock\MemcachedMock;
1616

17+
/**
18+
* @group legacy
19+
*/
1720
class MemcachedProfilerStorageTest extends AbstractProfilerStorageTest
1821
{
1922
protected static $storage;

src/Symfony/Component/HttpKernel/Tests/Profiler/MongoDbProfilerStorageTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ public function getName()
4747
}
4848
}
4949

50+
/**
51+
* @group legacy
52+
*/
5053
class MongoDbProfilerStorageTest extends AbstractProfilerStorageTest
5154
{
5255
protected static $storage;

src/Symfony/Component/HttpKernel/Tests/Profiler/RedisProfilerStorageTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
use Symfony\Component\HttpKernel\Profiler\RedisProfilerStorage;
1515
use Symfony\Component\HttpKernel\Tests\Profiler\Mock\RedisMock;
1616

17+
/**
18+
* @group legacy
19+
*/
1720
class RedisProfilerStorageTest extends AbstractProfilerStorageTest
1821
{
1922
protected static $storage;

src/Symfony/Component/HttpKernel/Tests/Profiler/SqliteProfilerStorageTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313

1414
use Symfony\Component\HttpKernel\Profiler\SqliteProfilerStorage;
1515

16+
/**
17+
* @group legacy
18+
*/
1619
class SqliteProfilerStorageTest extends AbstractProfilerStorageTest
1720
{
1821
protected static $dbFile;

0 commit comments

Comments
 (0)
0