Remove product literal strings in "pht()", part 21
[phabricator.git] / resources / sql / autopatches / 20140722.audit.4.migtext.php
blobc2a775058b3a8840796c9b5a0d203b80e89d14a7
1 <?php
3 $conn_w = id(new PhabricatorAuditTransaction())->establishConnection('w');
4 $rows = new LiskRawMigrationIterator($conn_w, 'audit_comment');
6 $content_source = PhabricatorContentSource::newForSource(
7 PhabricatorOldWorldContentSource::SOURCECONST)->serialize();
9 echo pht('Migrating Audit comment text to modern storage...')."\n";
10 foreach ($rows as $row) {
11 $id = $row['id'];
12 echo pht('Migrating Audit comment %d...', $id)."\n";
13 if (!strlen($row['content'])) {
14 echo pht('Comment has no text, continuing.')."\n";
15 continue;
18 $xaction_phid = PhabricatorPHID::generateNewPHID(
19 PhabricatorApplicationTransactionTransactionPHIDType::TYPECONST,
20 PhabricatorRepositoryCommitPHIDType::TYPECONST);
22 $comment_phid = PhabricatorPHID::generateNewPHID(
23 PhabricatorPHIDConstants::PHID_TYPE_XCMT,
24 PhabricatorRepositoryCommitPHIDType::TYPECONST);
26 queryfx(
27 $conn_w,
28 'INSERT IGNORE INTO %T
29 (phid, transactionPHID, authorPHID, viewPolicy, editPolicy,
30 commentVersion, content, contentSource, isDeleted,
31 dateCreated, dateModified, commitPHID, pathID,
32 legacyCommentID)
33 VALUES (%s, %s, %s, %s, %s,
34 %d, %s, %s, %d,
35 %d, %d, %s, %nd,
36 %d)',
37 'audit_transaction_comment',
39 // phid, transactionPHID, authorPHID, viewPolicy, editPolicy
40 $comment_phid,
41 $xaction_phid,
42 $row['actorPHID'],
43 'public',
44 $row['actorPHID'],
46 // commentVersion, content, contentSource, isDeleted
48 $row['content'],
49 $content_source,
52 // dateCreated, dateModified, commitPHID, pathID, legacyCommentID
53 $row['dateCreated'],
54 $row['dateModified'],
55 $row['targetPHID'],
56 null,
57 $row['id']);
60 echo pht('Done.')."\n";