mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-26 08:42:41 +01:00
2ec45d42a6
Summary: Ref T4310. Fixes T3720. This change: - Removes concurrent session limits. Instead, unused sessions are GC'd after a while. - Collapses all existing "web-1", "web-2", etc., sessions into "web" sessions. - Dramatically simplifies the code for establishing a session (like omg). Test Plan: Ran migration, checked Sessions panel and database for sanity. Used existing session. Logged out, logged in. Ran Conduit commands. Reviewers: btrahan Reviewed By: btrahan CC: aran Maniphest Tasks: T4310, T3720 Differential Revision: https://secure.phabricator.com/D7978
26 lines
677 B
PHP
26 lines
677 B
PHP
<?php
|
|
|
|
// Prior to this patch, we issued sessions "web-1", "web-2", etc., up to some
|
|
// limit. This collapses all the "web-X" sessions into "web" sessions.
|
|
|
|
$session_table = new PhabricatorAuthSession();
|
|
$conn_w = $session_table->establishConnection('w');
|
|
|
|
foreach (new LiskMigrationIterator($session_table) as $session) {
|
|
$id = $session->getID();
|
|
|
|
echo "Migrating session {$id}...\n";
|
|
$old_type = $session->getType();
|
|
$new_type = preg_replace('/-.*$/', '', $old_type);
|
|
|
|
if ($old_type !== $new_type) {
|
|
queryfx(
|
|
$conn_w,
|
|
'UPDATE %T SET type = %s WHERE id = %d',
|
|
$session_table->getTableName(),
|
|
$new_type,
|
|
$id);
|
|
}
|
|
}
|
|
|
|
echo "Done.\n";
|