@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 DifferentialRevision();
4$conn = $table->establishConnection('w');
5$diff_table = new DifferentialDiff();
6
7foreach (new LiskMigrationIterator($table) as $revision) {
8 $revision_id = $revision->getID();
9
10 $diff_row = queryfx_one(
11 $conn,
12 'SELECT phid FROM %T WHERE revisionID = %d ORDER BY id DESC LIMIT 1',
13 $diff_table->getTableName(),
14 $revision_id);
15
16 if ($diff_row) {
17 queryfx(
18 $conn,
19 'UPDATE %T SET activeDiffPHID = %s WHERE id = %d',
20 $table->getTableName(),
21 $diff_row['phid'],
22 $revision_id);
23 }
24}