@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
3echo pht('Migrating Differential unsubscribed users to edges...')."\n";
4$table = new DifferentialRevision();
5$table->openTransaction();
6
7// We couldn't use new LiskMigrationIterator($table) because the $unsubscribed
8// property gets deleted.
9$revs = queryfx_all(
10 $table->establishConnection('w'),
11 'SELECT id, phid, unsubscribed FROM differential_revision');
12
13foreach ($revs as $rev) {
14 echo '.';
15
16 $unsubscribed = json_decode($rev['unsubscribed']);
17 if (!$unsubscribed) {
18 continue;
19 }
20
21 $editor = new PhabricatorEdgeEditor();
22 foreach ($unsubscribed as $user_phid => $_) {
23 $editor->addEdge(
24 $rev['phid'],
25 PhabricatorObjectHasUnsubscriberEdgeType::EDGECONST ,
26 $user_phid);
27 }
28 $editor->save();
29}
30
31$table->saveTransaction();
32echo pht('Done.')."\n";