@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$paste_table = new PhabricatorPaste();
4$paste_conn = $paste_table->establishConnection('w');
5
6$properties_table = new PhabricatorMetaMTAMailProperties();
7$conn = $properties_table->establishConnection('w');
8
9$iterator = new LiskRawMigrationIterator(
10 $paste_conn,
11 $paste_table->getTableName());
12
13foreach ($iterator as $row) {
14 // The mailKey field might be unpopulated.
15 // This should have happened in the 20130805.pastemailkeypop.php migration,
16 // but that will not work on newer installations, because the paste table
17 // was renamed in between.
18 $mailkey = $row['mailKey'] ?? Filesystem::readRandomCharacters(20);
19
20 queryfx(
21 $conn,
22 'INSERT IGNORE INTO %T
23 (objectPHID, mailProperties, dateCreated, dateModified)
24 VALUES
25 (%s, %s, %d, %d)',
26 $properties_table->getTableName(),
27 $row['phid'],
28 phutil_json_encode(
29 array(
30 'mailKey' => $mailkey,
31 )),
32 PhabricatorTime::getNow(),
33 PhabricatorTime::getNow());
34}