@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('Giving image macros PHIDs');
4$table = new PhabricatorFileImageMacro();
5$table->openTransaction();
6
7foreach (new LiskMigrationIterator($table) as $macro) {
8 if ($macro->getPHID()) {
9 continue;
10 }
11
12 echo '.';
13
14 queryfx(
15 $macro->establishConnection('w'),
16 'UPDATE %T SET phid = %s WHERE id = %d',
17 $macro->getTableName(),
18 $macro->generatePHID(),
19 $macro->getID());
20}
21
22$table->saveTransaction();
23echo "\n".pht('Done.')."\n";