@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.)
hq.recaptime.dev/wiki/Phorge
phorge
phabricator
1<?php
2
3$audit_table = new PhabricatorAuditTransaction();
4$conn_w = $audit_table->establishConnection('w');
5$conn_w->openTransaction();
6
7$src_table = 'audit_inlinecomment';
8$dst_table = 'audit_transaction_comment';
9
10echo pht('Migrating Audit inline comments to new format...')."\n";
11
12$content_source = PhabricatorContentSource::newForSource(
13 PhabricatorOldWorldContentSource::SOURCECONST)->serialize();
14
15$rows = new LiskRawMigrationIterator($conn_w, $src_table);
16foreach ($rows as $row) {
17 $id = $row['id'];
18
19 echo pht('Migrating inline #%d...', $id);
20
21 if ($row['auditCommentID']) {
22 $xaction_phid = PhabricatorPHID::generateNewPHID(
23 PhabricatorApplicationTransactionTransactionPHIDType::TYPECONST,
24 PhabricatorRepositoryCommitPHIDType::TYPECONST);
25 } else {
26 $xaction_phid = null;
27 }
28
29 $comment_phid = PhabricatorPHID::generateNewPHID(
30 PhabricatorPHIDConstants::PHID_TYPE_XCMT,
31 PhabricatorRepositoryCommitPHIDType::TYPECONST);
32
33 queryfx(
34 $conn_w,
35 'INSERT IGNORE INTO %T
36 (id, phid, transactionPHID, authorPHID, viewPolicy, editPolicy,
37 commentVersion, content, contentSource, isDeleted,
38 dateCreated, dateModified, commitPHID, pathID,
39 isNewFile, lineNumber, lineLength, hasReplies, legacyCommentID)
40 VALUES (%d, %s, %ns, %s, %s, %s,
41 %d, %s, %s, %d,
42 %d, %d, %s, %nd,
43 %d, %d, %d, %d, %nd)',
44 $dst_table,
45
46 // id, phid, transactionPHID, authorPHID, viewPolicy, editPolicy
47 $row['id'],
48 $comment_phid,
49 $xaction_phid,
50 $row['authorPHID'],
51 'public',
52 $row['authorPHID'],
53
54 // commentVersion, content, contentSource, isDeleted
55 1,
56 $row['content'],
57 $content_source,
58 0,
59
60 // dateCreated, dateModified, commitPHID, pathID
61 $row['dateCreated'],
62 $row['dateModified'],
63 $row['commitPHID'],
64 $row['pathID'],
65
66 // isNewFile, lineNumber, lineLength, hasReplies, legacyCommentID
67 $row['isNewFile'],
68 $row['lineNumber'],
69 $row['lineLength'],
70 0,
71 $row['auditCommentID']);
72
73}
74
75$conn_w->saveTransaction();
76echo pht('Done.')."\n";