Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15431928
D13396.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D13396.diff
View Options
diff --git a/resources/sql/autopatches/20150622.metamta.4.actor-phid-col.sql b/resources/sql/autopatches/20150622.metamta.4.actor-phid-col.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20150622.metamta.4.actor-phid-col.sql
@@ -0,0 +1,2 @@
+ALTER TABLE {$NAMESPACE}_metamta.metamta_mail
+ ADD actorPHID VARBINARY(64) AFTER phid;
diff --git a/resources/sql/autopatches/20150622.metamta.5.actor-phid-mig.php b/resources/sql/autopatches/20150622.metamta.5.actor-phid-mig.php
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20150622.metamta.5.actor-phid-mig.php
@@ -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";
diff --git a/resources/sql/autopatches/20150622.metamta.6.actor-phid-key.sql b/resources/sql/autopatches/20150622.metamta.6.actor-phid-key.sql
new file mode 100644
--- /dev/null
+++ b/resources/sql/autopatches/20150622.metamta.6.actor-phid-key.sql
@@ -0,0 +1,2 @@
+ALTER TABLE {$NAMESPACE}_metamta.metamta_mail
+ ADD KEY `key_actorPHID` (actorPHID);
diff --git a/src/applications/metamta/storage/PhabricatorMetaMTAMail.php b/src/applications/metamta/storage/PhabricatorMetaMTAMail.php
--- a/src/applications/metamta/storage/PhabricatorMetaMTAMail.php
+++ b/src/applications/metamta/storage/PhabricatorMetaMTAMail.php
@@ -14,6 +14,7 @@
const RETRY_DELAY = 5;
+ protected $actorPHID;
protected $parameters;
protected $status;
protected $message;
@@ -36,6 +37,7 @@
'parameters' => self::SERIALIZATION_JSON,
),
self::CONFIG_COLUMN_SCHEMA => array(
+ 'actorPHID' => 'phid?',
'status' => 'text32',
'relatedPHID' => 'phid?',
@@ -47,6 +49,9 @@
'status' => array(
'columns' => array('status'),
),
+ 'key_actorPHID' => array(
+ 'columns' => array('actorPHID'),
+ ),
'relatedPHID' => array(
'columns' => array('relatedPHID'),
),
@@ -219,9 +224,14 @@
public function setFrom($from) {
$this->setParam('from', $from);
+ $this->setActorPHID($from);
return $this;
}
+ public function getFrom() {
+ return $this->getParam('from');
+ }
+
public function setRawFrom($raw_email, $raw_name) {
$this->setParam('raw-from', array($raw_email, $raw_name));
return $this;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mar 25 2025, 3:24 PM (4 w, 3 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7268607
Default Alt Text
D13396.diff (2 KB)
Attached To
Mode
D13396: MetaMTA - save actorPHID as its own column
Attached
Detach File
Event Timeline
Log In to Comment