Remove product literal strings in "pht()", part 21
[phabricator.git] / resources / sql / autopatches / 20191113.identity.02.populate.php
blobca86be0733081c00b17814b73945215892fe283c
1 <?php
3 $table = new PhabricatorRepositoryIdentity();
4 $conn = $table->establishConnection('w');
6 $iterator = new LiskRawMigrationIterator($conn, $table->getTableName());
7 foreach ($iterator as $row) {
8 $name = $row['identityNameRaw'];
9 $name = phutil_utf8ize($name);
11 $email = new PhutilEmailAddress($name);
12 $address = $email->getAddress();
14 try {
15 queryfx(
16 $conn,
17 'UPDATE %R SET emailAddress = %ns WHERE id = %d',
18 $table,
19 $address,
20 $row['id']);
21 } catch (Exception $ex) {
22 // We may occasionally run into issues with binary or very long addresses.
23 // Just skip over them.
24 continue;