Summary: Ref T5655. Rename `PhabricatorPHIDType` subclasses for clarity (see discussion in D9839). I'm not too keen on some of the resulting class names, so feel free to suggest alternatives. Test Plan: Ran unit tests. Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: epriestley, Korvin, hach-que Maniphest Tasks: T5655 Differential Revision: https://secure.phabricator.com/D9986
		
			
				
	
	
		
			49 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			49 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
 | 
						|
$table = new PhabricatorPaste();
 | 
						|
$x_table = new PhabricatorPasteTransaction();
 | 
						|
 | 
						|
$conn_w = $table->establishConnection('w');
 | 
						|
$conn_w->openTransaction();
 | 
						|
 | 
						|
echo "Adding transactions for existing paste objects...\n";
 | 
						|
 | 
						|
$rows = new LiskRawMigrationIterator($conn_w, 'pastebin_paste');
 | 
						|
foreach ($rows as $row) {
 | 
						|
 | 
						|
  $id = $row['id'];
 | 
						|
  echo "Adding transactions for paste id {$id}...\n";
 | 
						|
 | 
						|
  $xaction_phid = PhabricatorPHID::generateNewPHID(
 | 
						|
    PhabricatorApplicationTransactionTransactionPHIDType::TYPECONST);
 | 
						|
 | 
						|
  queryfx(
 | 
						|
    $conn_w,
 | 
						|
    'INSERT INTO %T (phid, authorPHID, objectPHID, viewPolicy, editPolicy,
 | 
						|
        transactionType, oldValue, newValue,
 | 
						|
        contentSource, metadata, dateCreated, dateModified,
 | 
						|
        commentVersion)
 | 
						|
      VALUES (%s, %s, %s, %s, %s, %s, %ns, %ns, %s, %s, %d, %d, %d)',
 | 
						|
    $x_table->getTableName(),
 | 
						|
    $xaction_phid,
 | 
						|
    $row['authorPHID'],
 | 
						|
    $row['phid'],
 | 
						|
    'public',
 | 
						|
    $row['authorPHID'],
 | 
						|
    PhabricatorPasteTransaction::TYPE_CONTENT,
 | 
						|
    'null',
 | 
						|
    $row['filePHID'],
 | 
						|
    PhabricatorContentSource::newForSource(
 | 
						|
      PhabricatorContentSource::SOURCE_LEGACY,
 | 
						|
      array())->serialize(),
 | 
						|
    '[]',
 | 
						|
    $row['dateCreated'],
 | 
						|
    $row['dateCreated'],
 | 
						|
    0);
 | 
						|
 | 
						|
}
 | 
						|
 | 
						|
$conn_w->saveTransaction();
 | 
						|
 | 
						|
echo "Done.\n";
 |