2014-02-18 21:18:04 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
$table = new PhabricatorRepositoryVCSPassword();
|
|
|
|
$conn_w = $table->establishConnection('w');
|
|
|
|
|
2015-05-22 09:27:56 +02:00
|
|
|
echo pht('Upgrading password hashing for VCS passwords.')."\n";
|
2014-02-18 21:18:04 +01:00
|
|
|
|
|
|
|
$best_hasher = PhabricatorPasswordHasher::getBestHasher();
|
|
|
|
foreach (new LiskMigrationIterator($table) as $password) {
|
|
|
|
$id = $password->getID();
|
|
|
|
|
2015-05-22 09:27:56 +02:00
|
|
|
echo pht('Migrating VCS password %d...', $id)."\n";
|
2014-02-18 21:18:04 +01:00
|
|
|
|
|
|
|
$input_hash = $password->getPasswordHash();
|
|
|
|
$input_envelope = new PhutilOpaqueEnvelope($input_hash);
|
|
|
|
|
|
|
|
$storage_hash = $best_hasher->getPasswordHashForStorage($input_envelope);
|
|
|
|
|
|
|
|
queryfx(
|
|
|
|
$conn_w,
|
|
|
|
'UPDATE %T SET passwordHash = %s WHERE id = %d',
|
|
|
|
$table->getTableName(),
|
|
|
|
$storage_hash->openEnvelope(),
|
|
|
|
$id);
|
|
|
|
}
|
|
|
|
|
2015-05-22 09:27:56 +02:00
|
|
|
echo pht('Done.')."\n";
|