[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/resources/sql/patches/ -> 20130805.pastemailkeypop.php (source)

   1  <?php
   2  
   3  echo "Populating pastes with mail keys...\n";
   4  
   5  $table = new PhabricatorPaste();
   6  $table->openTransaction();
   7  $conn_w = $table->establishConnection('w');
   8  
   9  foreach (new LiskMigrationIterator($table) as $paste) {
  10    $id = $paste->getID();
  11  
  12    echo "P{$id}: ";
  13    if (!$paste->getMailKey()) {
  14      queryfx(
  15        $conn_w,
  16        'UPDATE %T SET mailKey = %s WHERE id = %d',
  17        $paste->getTableName(),
  18        Filesystem::readRandomCharacters(20),
  19        $id);
  20      echo "Generated Key\n";
  21    } else {
  22      echo "-\n";
  23    }
  24  }
  25  
  26  $table->saveTransaction();
  27  echo "Done.\n";


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