Correct Aphlict websocket URI construction after PHP8 compatibility changes
[phabricator.git] / resources / sql / autopatches / 20180910.audit.04.xactions.php
blob1ecf9ef320e10ec9ad9446fa822bd87d1563c0b4
1 <?php
3 $table = new PhabricatorAuditTransaction();
4 $conn = $table->establishConnection('w');
6 $status_map = array(
7 0 => 'none',
8 1 => 'needs-audit',
9 2 => 'concern-raised',
10 3 => 'partially-audited',
11 4 => 'audited',
12 5 => 'needs-verification',
15 $state_type = DiffusionCommitStateTransaction::TRANSACTIONTYPE;
17 foreach (new LiskMigrationIterator($table) as $xaction) {
18 if ($xaction->getTransactionType() !== $state_type) {
19 continue;
22 $old_value = $xaction->getOldValue();
23 $new_value = $xaction->getNewValue();
25 $any_change = false;
27 if (isset($status_map[$old_value])) {
28 $old_value = $status_map[$old_value];
29 $any_change = true;
32 if (isset($status_map[$new_value])) {
33 $new_value = $status_map[$new_value];
34 $any_change = true;
37 if (!$any_change) {
38 continue;
41 queryfx(
42 $conn,
43 'UPDATE %T SET oldValue = %s, newValue = %s WHERE id = %d',
44 $table->getTableName(),
45 phutil_json_encode($old_value),
46 phutil_json_encode($new_value),
47 $xaction->getID());