[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/resources/sql/patches/ -> 20130201.revisionunsubscribed.php (source)

   1  <?php
   2  
   3  echo "Migrating Differential unsubscribed users to edges...\n";
   4  $table = new DifferentialRevision();
   5  $table->openTransaction();
   6  
   7  // We couldn't use new LiskMigrationIterator($table) because the $unsubscribed
   8  // property gets deleted.
   9  $revs = queryfx_all(
  10    $table->establishConnection('w'),
  11    'SELECT id, phid, unsubscribed FROM differential_revision');
  12  
  13  foreach ($revs as $rev) {
  14    echo '.';
  15  
  16    $unsubscribed = json_decode($rev['unsubscribed']);
  17    if (!$unsubscribed) {
  18      continue;
  19    }
  20  
  21    $editor = new PhabricatorEdgeEditor();
  22    foreach ($unsubscribed as $user_phid => $_) {
  23      $editor->addEdge(
  24        $rev['phid'],
  25        PhabricatorEdgeConfig::TYPE_OBJECT_HAS_UNSUBSCRIBER,
  26        $user_phid);
  27    }
  28    $editor->save();
  29  }
  30  
  31  $table->saveTransaction();
  32  echo "Done.\n";


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