Changeset View
Changeset View
Standalone View
Standalone View
resources/sql/autopatches/20180121.auth.04.accountphid.php
- This file was copied from resources/sql/autopatches/20180120.auth.04.vcsphid.php.
<?php | <?php | ||||
// Populate VCS passwords (which we copied from the old "VCS Password" table | // Populate account passwords (which we copied from the user table in the last | ||||
// in the last migration) with new PHIDs. | // migration) with new PHIDs. | ||||
$table = new PhabricatorAuthPassword(); | $table = new PhabricatorAuthPassword(); | ||||
$conn = $table->establishConnection('w'); | $conn = $table->establishConnection('w'); | ||||
$password_type = PhabricatorAuthPasswordPHIDType::TYPECONST; | |||||
foreach (new LiskMigrationIterator($table) as $row) { | foreach (new LiskMigrationIterator($table) as $row) { | ||||
if ($row->getPHID()) { | if (phid_get_type($row->getPHID()) == $password_type) { | ||||
continue; | continue; | ||||
} | } | ||||
$new_phid = $row->generatePHID(); | $new_phid = $row->generatePHID(); | ||||
queryfx( | queryfx( | ||||
$conn, | $conn, | ||||
'UPDATE %T SET phid = %s WHERE id = %d', | 'UPDATE %T SET phid = %s WHERE id = %d', | ||||
$table->getTableName(), | $table->getTableName(), | ||||
$new_phid, | $new_phid, | ||||
$row->getID()); | $row->getID()); | ||||
} | } |