1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-24 06:20:56 +01:00
phorge-phorge/resources/sql/autopatches/20150622.metamta.5.actor-phid-mig.php
Bob Trahan 4be568d346 MetaMTA - save actorPHID as its own column
Summary: Ref T5791. This should make performance snappy wrt policy checks in some future diff where the Query is updated and in use somewhere in the application.

Test Plan: ran `./bin/storage upgrade`. commented on a task and saw actorPHID populated correctly in underlying MetaMTAMail object database entry

Reviewers: epriestley

Reviewed By: epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T5791

Differential Revision: https://secure.phabricator.com/D13396
2015-06-22 14:14:21 -07:00

27 lines
555 B
PHP

<?php
$table = new PhabricatorMetaMTAMail();
$conn_w = $table->establishConnection('w');
echo pht('Assigning actorPHIDs to mails...')."\n";
foreach (new LiskMigrationIterator($table) as $mail) {
$id = $mail->getID();
echo pht('Updating mail %d...', $id)."\n";
if ($mail->getActorPHID()) {
continue;
}
$actor_phid = $mail->getFrom();
if ($actor_phid === null) {
continue;
}
queryfx(
$conn_w,
'UPDATE %T SET actorPHID = %s WHERE id = %d',
$table->getTableName(),
$actor_phid,
$id);
}
echo pht('Done.')."\n";