@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 PhabricatorFileImageMacro();
4foreach (new LiskMigrationIterator($table) as $macro) {
5 $name = $macro->getName();
6
7 echo pht("Linking macro '%s'...", $name)."\n";
8
9 $editor = new PhabricatorEdgeEditor();
10
11 $phids[] = $macro->getFilePHID();
12 $phids[] = $macro->getAudioPHID();
13 $phids = array_filter($phids);
14
15 if ($phids) {
16 foreach ($phids as $phid) {
17 $editor->addEdge(
18 $macro->getPHID(),
19 25,
20 $phid);
21 }
22 $editor->save();
23 }
24}
25
26echo pht('Done.')."\n";