8000 Reworded and simplified · symfony/symfony-docs@386f639 · GitHub
[go: up one dir, main page]

Skip to content

Commit 386f639

Browse files
Reworded and simplified
1 parent 7c8264d commit 386f639

File tree

1 file changed

+13
-18
lines changed

1 file changed

+13
-18
lines changed

components/http_foundation/session_configuration.rst

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -91,30 +91,25 @@ Example usage::
9191
Migrating Between Save Handlers
9292
-------------------------------
9393

94-
The :class:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\MigratingSessionHandler`
95-
can be used to migrate between old and new save handlers without losing session data.
94+
If your application changes the way sessions are stored, use the
95+
:class:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler\\MigratingSessionHandler`
96+
to migrate between old and new save handlers without losing session data.
9697

97-
It can be used to support the following workflow:
98+
This is the recommended migration workflow:
9899

99-
* Switch to the migrating handler, with your new handler as the write-only one. The old handler behaves as usual and sessions get written to the new one.
100-
* After your session gc period, verify the data in the new handler
101-
* Update the migrating handler to use the old handler as the write-only one, so the sessions will now be read from the new handler. This step allows easier rollbacks.
102-
* After verifying that the sessions in your app are working, switch from the migrating handler to the new handler.
100< 8000 code class="diff-text syntax-highlighted-line addition">+
#. Switch to the migrating handler, with your new handler as the write-only one.
101+
The old handler behaves as usual and sessions get written to the new one::
103102

104-
Example usage::
105-
106-
use Symfony\Component\HttpFoundation\Session\Storage\Handler\MigratingSessionHandler;
107-
108-
$oldSessionStorage = ...;
109-
$newSessionStorage = ...;
103+
$sessionStorage = new MigratingSessionHandler($oldSessionStorage, $newSessionStorage);
110104

111-
// First step, for the the garbage collection period so we get all sessions in the new storage handler
112-
$sessionStorage = new MigratingSessionHandler($oldSessionStorage, $newSessionStorage);
105+
#. After your session gc period, verify that the data in the new handler is correct.
106+
#. Update the migrating handler to use the old handler as the write-only one, so
107+
the sessions will now be read from the new handler. This step allows easier rollbacks::
113108

114-
// Second step, just while we verify that the new session storage handler works as expected
115-
$sessionStorage = new MigratingSessionHandler($newSessionStorage, $oldSessionStorage);
109+
$sessionStorage = new MigratingSessionHandler($newSessionStorage, $oldSessionStorage);
116110

117-
// Final step - switching to the new storage handler!
111+
#. After verifying that the sessions in your application are working, switch
112+
from the migrating handler to the new handler.
118113
$sessionStorage = $newSessionStorage;
119114

120115
Configuring PHP Sessions

0 commit comments

Comments
 (0)
0