mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-30 01:10:58 +01:00
c58506aeaa
Summary: Ref T13222. See PHI873. I'm preparing to introduce a new MFA "Challenge" table which stores state about challenges we've issued (to bind challenges to sessions and prevent most challenge reuse). This table will reference sessions (since each challenge will be bound to a particular session) but sessions currently don't have PHIDs. Give them PHIDs and slightly modernize some related code. Test Plan: - Ran migrations. - Verified table got PHIDs. - Used `var_dump()` to dump an organic user session. Reviewers: amckinley Reviewed By: amckinley Subscribers: PHID-OPKG-gm6ozazyms6q6i22gyam Maniphest Tasks: T13222 Differential Revision: https://secure.phabricator.com/D19881
18 lines
361 B
PHP
18 lines
361 B
PHP
<?php
|
|
|
|
$table = new PhabricatorAuthSession();
|
|
$iterator = new LiskMigrationIterator($table);
|
|
$conn = $table->establishConnection('w');
|
|
|
|
foreach ($iterator as $session) {
|
|
if (strlen($session->getPHID())) {
|
|
continue;
|
|
}
|
|
|
|
queryfx(
|
|
$conn,
|
|
'UPDATE %R SET phid = %s WHERE id = %d',
|
|
$table,
|
|
$session->generatePHID(),
|
|
$session->getID());
|
|
}
|