@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$table = new HarbormasterBuildable();
4$conn = $table->establishConnection('w');
5
6foreach (new LiskMigrationIterator($table) as $buildable) {
7 if ($buildable->getBuildableStatus() !== 'building') {
8 continue;
9 }
10
11 $aborted = queryfx_one(
12 $conn,
13 'SELECT * FROM %T WHERE buildablePHID = %s AND buildStatus = %s
14 LIMIT 1',
15 id(new HarbormasterBuild())->getTableName(),
16 $buildable->getPHID(),
17 'aborted');
18 if (!$aborted) {
19 continue;
20 }
21
22 queryfx(
23 $conn,
24 'UPDATE %T SET buildableStatus = %s WHERE id = %d',
25 $table->getTableName(),
26 'failed',
27 $buildable->getID());
28}