@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// See T13072. Turn the old "process a command" transaction into modular
4// transactions that each handle one particular type of command.
5
6$xactions_table = new HarbormasterBuildTransaction();
7$xactions_conn = $xactions_table->establishConnection('w');
8$row_iterator = new LiskRawMigrationIterator(
9 $xactions_conn,
10 $xactions_table->getTableName());
11
12$map = array(
13 '"pause"' => 'message/pause',
14 '"abort"' => 'message/abort',
15 '"resume"' => 'message/resume',
16 '"restart"' => 'message/restart',
17);
18
19foreach ($row_iterator as $row) {
20 if ($row['transactionType'] !== 'harbormaster:build:command') {
21 continue;
22 }
23
24 $raw_value = $row['newValue'];
25
26 if (isset($map[$raw_value])) {
27 queryfx(
28 $xactions_conn,
29 'UPDATE %R SET transactionType = %s WHERE id = %d',
30 $xactions_table,
31 $map[$raw_value],
32 $row['id']);
33 }
34}