[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/resources/sql/autopatches/ -> 20140218.passwords.4.vcs.php (source)

   1  <?php
   2  
   3  $table = new PhabricatorRepositoryVCSPassword();
   4  $conn_w = $table->establishConnection('w');
   5  
   6  echo "Upgrading password hashing for VCS passwords.\n";
   7  
   8  $best_hasher = PhabricatorPasswordHasher::getBestHasher();
   9  foreach (new LiskMigrationIterator($table) as $password) {
  10    $id = $password->getID();
  11  
  12    echo "Migrating VCS password {$id}...\n";
  13  
  14    $input_hash = $password->getPasswordHash();
  15    $input_envelope = new PhutilOpaqueEnvelope($input_hash);
  16  
  17    $storage_hash = $best_hasher->getPasswordHashForStorage($input_envelope);
  18  
  19    queryfx(
  20      $conn_w,
  21      'UPDATE %T SET passwordHash = %s WHERE id = %d',
  22      $table->getTableName(),
  23      $storage_hash->openEnvelope(),
  24      $id);
  25  }
  26  
  27  echo "Done.\n";


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1