mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-28 07:28:20 +01:00
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
This commit is contained in:
parent
ea5462fb60
commit
4be568d346
4 changed files with 41 additions and 0 deletions
|
@ -0,0 +1,2 @@
|
||||||
|
ALTER TABLE {$NAMESPACE}_metamta.metamta_mail
|
||||||
|
ADD actorPHID VARBINARY(64) AFTER phid;
|
|
@ -0,0 +1,27 @@
|
||||||
|
<?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";
|
|
@ -0,0 +1,2 @@
|
||||||
|
ALTER TABLE {$NAMESPACE}_metamta.metamta_mail
|
||||||
|
ADD KEY `key_actorPHID` (actorPHID);
|
|
@ -14,6 +14,7 @@ final class PhabricatorMetaMTAMail
|
||||||
|
|
||||||
const RETRY_DELAY = 5;
|
const RETRY_DELAY = 5;
|
||||||
|
|
||||||
|
protected $actorPHID;
|
||||||
protected $parameters;
|
protected $parameters;
|
||||||
protected $status;
|
protected $status;
|
||||||
protected $message;
|
protected $message;
|
||||||
|
@ -36,6 +37,7 @@ final class PhabricatorMetaMTAMail
|
||||||
'parameters' => self::SERIALIZATION_JSON,
|
'parameters' => self::SERIALIZATION_JSON,
|
||||||
),
|
),
|
||||||
self::CONFIG_COLUMN_SCHEMA => array(
|
self::CONFIG_COLUMN_SCHEMA => array(
|
||||||
|
'actorPHID' => 'phid?',
|
||||||
'status' => 'text32',
|
'status' => 'text32',
|
||||||
'relatedPHID' => 'phid?',
|
'relatedPHID' => 'phid?',
|
||||||
|
|
||||||
|
@ -47,6 +49,9 @@ final class PhabricatorMetaMTAMail
|
||||||
'status' => array(
|
'status' => array(
|
||||||
'columns' => array('status'),
|
'columns' => array('status'),
|
||||||
),
|
),
|
||||||
|
'key_actorPHID' => array(
|
||||||
|
'columns' => array('actorPHID'),
|
||||||
|
),
|
||||||
'relatedPHID' => array(
|
'relatedPHID' => array(
|
||||||
'columns' => array('relatedPHID'),
|
'columns' => array('relatedPHID'),
|
||||||
),
|
),
|
||||||
|
@ -219,9 +224,14 @@ final class PhabricatorMetaMTAMail
|
||||||
|
|
||||||
public function setFrom($from) {
|
public function setFrom($from) {
|
||||||
$this->setParam('from', $from);
|
$this->setParam('from', $from);
|
||||||
|
$this->setActorPHID($from);
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getFrom() {
|
||||||
|
return $this->getParam('from');
|
||||||
|
}
|
||||||
|
|
||||||
public function setRawFrom($raw_email, $raw_name) {
|
public function setRawFrom($raw_email, $raw_name) {
|
||||||
$this->setParam('raw-from', array($raw_email, $raw_name));
|
$this->setParam('raw-from', array($raw_email, $raw_name));
|
||||||
return $this;
|
return $this;
|
||||||
|
|
Loading…
Add table
Reference in a new issue