Changeset View
Changeset View
Standalone View
Standalone View
resources/sql/autopatches/20140115.auth.3.unlimit.php
| <?php | <?php | ||||
| // Prior to this patch, we issued sessions "web-1", "web-2", etc., up to some | // 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. | // limit. This collapses all the "web-X" sessions into "web" sessions. | ||||
| $session_table = new PhabricatorAuthSession(); | $session_table = new PhabricatorAuthSession(); | ||||
| $conn_w = $session_table->establishConnection('w'); | $conn_w = $session_table->establishConnection('w'); | ||||
| foreach (new LiskMigrationIterator($session_table) as $session) { | foreach (new LiskMigrationIterator($session_table) as $session) { | ||||
| $id = $session->getID(); | $id = $session->getID(); | ||||
| echo "Migrating session {$id}...\n"; | echo pht('Migrating session %d...', $id)."\n"; | ||||
| $old_type = $session->getType(); | $old_type = $session->getType(); | ||||
| $new_type = preg_replace('/-.*$/', '', $old_type); | $new_type = preg_replace('/-.*$/', '', $old_type); | ||||
| if ($old_type !== $new_type) { | if ($old_type !== $new_type) { | ||||
| queryfx( | queryfx( | ||||
| $conn_w, | $conn_w, | ||||
| 'UPDATE %T SET type = %s WHERE id = %d', | 'UPDATE %T SET type = %s WHERE id = %d', | ||||
| $session_table->getTableName(), | $session_table->getTableName(), | ||||
| $new_type, | $new_type, | ||||
| $id); | $id); | ||||
| } | } | ||||
| } | } | ||||
| echo "Done.\n"; | echo pht('Done.')."\n"; | ||||