2014-07-25 03:00:30 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
$conn_w = id(new PhabricatorAuditTransaction())->establishConnection('w');
|
|
|
|
$rows = new LiskRawMigrationIterator($conn_w, 'audit_comment');
|
|
|
|
|
|
|
|
$content_source = PhabricatorContentSource::newForSource(
|
2016-03-25 13:56:16 +01:00
|
|
|
PhabricatorOldWorldContentSource::SOURCECONST)->serialize();
|
2014-07-25 03:00:30 +02:00
|
|
|
|
2015-05-22 09:27:56 +02:00
|
|
|
echo pht('Migrating Audit comment text to modern storage...')."\n";
|
2014-07-25 03:00:30 +02:00
|
|
|
foreach ($rows as $row) {
|
|
|
|
$id = $row['id'];
|
2015-05-22 09:27:56 +02:00
|
|
|
echo pht('Migrating Audit comment %d...', $id)."\n";
|
2014-07-25 03:00:30 +02:00
|
|
|
if (!strlen($row['content'])) {
|
2015-05-22 09:27:56 +02:00
|
|
|
echo pht('Comment has no text, continuing.')."\n";
|
2014-07-25 03:00:30 +02:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
$xaction_phid = PhabricatorPHID::generateNewPHID(
|
|
|
|
PhabricatorApplicationTransactionTransactionPHIDType::TYPECONST,
|
|
|
|
PhabricatorRepositoryCommitPHIDType::TYPECONST);
|
|
|
|
|
|
|
|
$comment_phid = PhabricatorPHID::generateNewPHID(
|
|
|
|
PhabricatorPHIDConstants::PHID_TYPE_XCMT,
|
|
|
|
PhabricatorRepositoryCommitPHIDType::TYPECONST);
|
|
|
|
|
|
|
|
queryfx(
|
|
|
|
$conn_w,
|
|
|
|
'INSERT IGNORE INTO %T
|
|
|
|
(phid, transactionPHID, authorPHID, viewPolicy, editPolicy,
|
|
|
|
commentVersion, content, contentSource, isDeleted,
|
|
|
|
dateCreated, dateModified, commitPHID, pathID,
|
|
|
|
legacyCommentID)
|
|
|
|
VALUES (%s, %s, %s, %s, %s,
|
|
|
|
%d, %s, %s, %d,
|
|
|
|
%d, %d, %s, %nd,
|
|
|
|
%d)',
|
|
|
|
'audit_transaction_comment',
|
|
|
|
|
|
|
|
// phid, transactionPHID, authorPHID, viewPolicy, editPolicy
|
|
|
|
$comment_phid,
|
|
|
|
$xaction_phid,
|
|
|
|
$row['actorPHID'],
|
|
|
|
'public',
|
|
|
|
$row['actorPHID'],
|
|
|
|
|
|
|
|
// commentVersion, content, contentSource, isDeleted
|
|
|
|
1,
|
|
|
|
$row['content'],
|
|
|
|
$content_source,
|
|
|
|
0,
|
|
|
|
|
|
|
|
// dateCreated, dateModified, commitPHID, pathID, legacyCommentID
|
|
|
|
$row['dateCreated'],
|
|
|
|
$row['dateModified'],
|
|
|
|
$row['targetPHID'],
|
|
|
|
null,
|
|
|
|
$row['id']);
|
|
|
|
}
|
|
|
|
|
2015-05-22 09:27:56 +02:00
|
|
|
echo pht('Done.')."\n";
|