[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/resources/sql/patches/ -> 20130801.pastexactions.php (source)

   1  <?php
   2  
   3  $table = new PhabricatorPaste();
   4  $x_table = new PhabricatorPasteTransaction();
   5  
   6  $conn_w = $table->establishConnection('w');
   7  $conn_w->openTransaction();
   8  
   9  echo "Adding transactions for existing paste objects...\n";
  10  
  11  $rows = new LiskRawMigrationIterator($conn_w, 'pastebin_paste');
  12  foreach ($rows as $row) {
  13  
  14    $id = $row['id'];
  15    echo "Adding transactions for paste id {$id}...\n";
  16  
  17    $xaction_phid = PhabricatorPHID::generateNewPHID(
  18      PhabricatorApplicationTransactionTransactionPHIDType::TYPECONST);
  19  
  20    queryfx(
  21      $conn_w,
  22      'INSERT INTO %T (phid, authorPHID, objectPHID, viewPolicy, editPolicy,
  23          transactionType, oldValue, newValue,
  24          contentSource, metadata, dateCreated, dateModified,
  25          commentVersion)
  26        VALUES (%s, %s, %s, %s, %s, %s, %ns, %ns, %s, %s, %d, %d, %d)',
  27      $x_table->getTableName(),
  28      $xaction_phid,
  29      $row['authorPHID'],
  30      $row['phid'],
  31      'public',
  32      $row['authorPHID'],
  33      PhabricatorPasteTransaction::TYPE_CONTENT,
  34      'null',
  35      $row['filePHID'],
  36      PhabricatorContentSource::newForSource(
  37        PhabricatorContentSource::SOURCE_LEGACY,
  38        array())->serialize(),
  39      '[]',
  40      $row['dateCreated'],
  41      $row['dateCreated'],
  42      0);
  43  
  44  }
  45  
  46  $conn_w->saveTransaction();
  47  
  48  echo "Done.\n";


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