@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('Adding mailkeys to macros.')."\n";
4
5$table = new PhabricatorFileImageMacro();
6$conn_w = $table->establishConnection('w');
7$iterator = new LiskMigrationIterator($table);
8foreach ($iterator as $macro) {
9 $id = $macro->getID();
10
11 echo pht('Populating macro %d...', $id)."\n";
12
13 if (!$macro->getMailKey()) {
14 queryfx(
15 $conn_w,
16 'UPDATE %T SET mailKey = %s WHERE id = %d',
17 $table->getTableName(),
18 Filesystem::readRandomCharacters(20),
19 $id);
20 }
21}
22
23echo pht('Done.')."\n";